Class: TavernaPlayer::ModelProxy
- Inherits:
-
Object
- Object
- TavernaPlayer::ModelProxy
- Defined in:
- lib/taverna_player/model_proxy.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
Instance Method Summary collapse
- #class_const ⇒ Object
-
#initialize(class_name, method_names = []) ⇒ ModelProxy
constructor
A new instance of ModelProxy.
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_name ⇒ Object (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_const ⇒ Object
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 |