Class: Intercom::Lib::DynamicAccessorsOnMethodMissing
- Inherits:
-
Object
- Object
- Intercom::Lib::DynamicAccessorsOnMethodMissing
- Defined in:
- lib/intercom/lib/dynamic_accessors_on_method_missing.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#method_string ⇒ Object
readonly
Returns the value of attribute method_string.
-
#method_sym ⇒ Object
readonly
Returns the value of attribute method_sym.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #define_accessors_or_call(&block) ⇒ Object
-
#initialize(method_sym, *arguments, object) ⇒ DynamicAccessorsOnMethodMissing
constructor
A new instance of DynamicAccessorsOnMethodMissing.
Constructor Details
#initialize(method_sym, *arguments, object) ⇒ DynamicAccessorsOnMethodMissing
Returns a new instance of DynamicAccessorsOnMethodMissing.
7 8 9 10 11 12 13 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 7 def initialize(method_sym, *arguments, object) @method_sym = method_sym @method_string = method_sym.to_s @arguments = arguments @klass = object.class @object = object end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
5 6 7 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 5 def arguments @arguments end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 5 def klass @klass end |
#method_string ⇒ Object (readonly)
Returns the value of attribute method_string.
5 6 7 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 5 def method_string @method_string end |
#method_sym ⇒ Object (readonly)
Returns the value of attribute method_sym.
5 6 7 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 5 def method_sym @method_sym end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 5 def object @object end |
Instance Method Details
#define_accessors_or_call(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/intercom/lib/dynamic_accessors_on_method_missing.rb', line 15 def define_accessors_or_call(&block) return yield if not_an_accessor? if setter? Lib::DynamicAccessors.define_accessors(attribute_name, *arguments, object) object.send(method_sym, *arguments) else # getter if || yield else raise Intercom::AttributeNotSetError, end end end |