Class: ArcadiaExt

Inherits:
Object
  • Object
show all
Defined in:
lib/a-commons.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_arcadia, _name = nil) ⇒ ArcadiaExt

Returns a new instance of ArcadiaExt.



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/a-commons.rb', line 179

def initialize(_arcadia, _name=nil)
  @arcadia = _arcadia
  Arcadia.attach_listener(self, BuildEvent)
  Arcadia.attach_listener(self, ExitQueryEvent)
  Arcadia.attach_listener(self, FinalizeEvent)
  @name = _name
  @frames = Array.new
  @frames_points = conf_array("#{_name}.frames")
  @frames_labels = conf_array("#{_name}.frames.labels")
  @frames_names = conf_array("#{_name}.frames.names")
  @float_frames = Array.new
  @float_geometries = conf_array("#{_name}.float_frames")
  @float_labels = conf_array("#{_name}.float_labels")
  #ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
end

Instance Attribute Details

#arcadiaObject (readonly)

Returns the value of attribute arcadia.



178
179
180
# File 'lib/a-commons.rb', line 178

def arcadia
  @arcadia
end

Instance Method Details

#conf(_property) ⇒ Object



219
220
221
# File 'lib/a-commons.rb', line 219

def conf(_property)
 @arcadia['conf'][@name+'.'+_property]
end

#conf_array(_name) ⇒ Object



195
196
197
198
199
200
# File 'lib/a-commons.rb', line 195

def conf_array(_name)
  res = []
  value = @arcadia['conf'][_name]
  res.concat(value.split(',')) if value
  res
end

#exec(_method, _args = nil) ⇒ Object

def conf_global(_property)

 @arcadia['conf'][_property]
end


227
228
229
230
231
# File 'lib/a-commons.rb', line 227

def exec(_method, _args=nil)
  if self.respond_to(_method)
    self.send(_method, _args)
  end
end

#float_frame(_n = 0, _args = nil) ⇒ Object



211
212
213
214
215
216
217
# File 'lib/a-commons.rb', line 211

def float_frame(_n=0, _args=nil)
 if @float_frames[_n].nil? 
   (@float_labels[_n].nil?)? _label = @name : _label = @float_labels[_n]
   @float_frames[_n] =  FloatFrameWrapper.new(@arcadia, @float_geometries[_n], _label)
 end
   @float_frames[_n]
end

#frame(_n = 0) ⇒ Object



202
203
204
205
206
207
208
209
# File 'lib/a-commons.rb', line 202

def frame(_n=0)
 if @frames[_n] == nil && @frames_points[_n]
   (@frames_labels[_n].nil?)? _label = @name : _label = @frames_labels[_n]
   (@frames_names[_n].nil?)? _name = @name : _name = @frames_names[_n]
   @frames[_n] =  FixedFrameWrapper.new(@name, @frames_points[_n], _name, _label)
 end
  return @frames[_n]
end