Class: TavernaPlayer::ModelProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/taverna_player/model_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, method_names = []) ⇒ ModelProxy

Returns a new instance of ModelProxy.



17
18
19
20
21
22
23
# File 'lib/taverna_player/model_proxy.rb', line 17

def initialize(class_name, method_names = [])
  @class_name = root_name(class_name.to_s)

  method_names.each do |name|
    add_method(name.to_sym)
  end
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



15
16
17
# File 'lib/taverna_player/model_proxy.rb', line 15

def class_name
  @class_name
end

Instance Method Details

#class_constObject



25
26
27
28
29
30
31
# File 'lib/taverna_player/model_proxy.rb', line 25

def class_const
  @const ||= begin
               Object.const_get(@class_name)
             rescue NameError
               @class_name.constantize
             end
end