class Microstation::Configuration
Public Class Methods
new(app)
click to toggle source
# File lib/microstation/configuration.rb, line 93 def initialize(app) @app = app end
Public Instance Methods
[](variable)
click to toggle source
# File lib/microstation/configuration.rb, line 117 def [](variable) return nil unless exists? variable get(variable) end
[]=(key,value)
click to toggle source
# File lib/microstation/configuration.rb, line 138 def []=(key,value) set(key,value) end
append(variable,value)
click to toggle source
# File lib/microstation/configuration.rb, line 107 def append(variable,value) if exists?(variable) old_value = get(variable) new_value = "#{old_value};#{value}" else new_value = value.to_s end set!(variable,new_value) end
capabilities_all()
click to toggle source
# File lib/microstation/configuration.rb, line 146 def capabilities_all @workmode_all ||= Capabilities.new(self,'_USTN_CAPABILITY') end
exists?(value)
click to toggle source
# File lib/microstation/configuration.rb, line 142 def exists?(value) workspace.IsConfigurationVariableDefined(value) end
expand(string)
click to toggle source
# File lib/microstation/configuration.rb, line 151 def expand(string) workspace.ExpandConfigurationVariable(string) end
prepend(variable,value)
click to toggle source
# File lib/microstation/configuration.rb, line 97 def prepend(variable,value) if exists?(variable) old_value = get(variable) new_value = "#{value};#{old_value}" else new_value = value.to_s end set!(variable,new_value) end
remove_variable(variable)
click to toggle source
# File lib/microstation/configuration.rb, line 123 def remove_variable(variable) workspace.RemoveConfigurationVariable variable end
set(key,value,options = {})
click to toggle source
# File lib/microstation/configuration.rb, line 127 def set(key,value,options = {}) raise VariableDefined unless should_update?(key,options) set!(key,value) end
set!(key,value)
click to toggle source
# File lib/microstation/configuration.rb, line 132 def set!(key,value) self.remove_variable(key) workspace.AddConfigurationVariable(key,value) end
Private Instance Methods
get(variable)
click to toggle source
# File lib/microstation/configuration.rb, line 160 def get(variable) workspace.ConfigurationVariableValue(variable) end
should_update?(key,options={force: false})
click to toggle source
# File lib/microstation/configuration.rb, line 164 def should_update?(key,options={force: false}) return true unless exists? key force = options.fetch(:force){ false} return !!force end
workspace()
click to toggle source
# File lib/microstation/configuration.rb, line 156 def workspace @app.active_workspace end