Class: AmsHal::Link
- Inherits:
-
Object
- Object
- AmsHal::Link
- Includes:
- ActiveModelSerializers::SerializationContext::UrlHelpers
- Defined in:
- lib/ams_hal/link.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(serializer, value) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(serializer, value) ⇒ Link
Returns a new instance of Link.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ams_hal/link.rb', line 9 def initialize(serializer, value) @object = serializer.object @scope = serializer.scope @self_before_instance_eval = nil # Use the return value of the block unless it is nil. if value.respond_to?(:call) @self_before_instance_eval = eval "self", value.binding @value = instance_eval(&value) else @value = value end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
24 25 26 27 |
# File 'lib/ams_hal/link.rb', line 24 def method_missing(method, *args, &block) return super unless @self_before_instance_eval @self_before_instance_eval.send method, *args, &block end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/ams_hal/link.rb', line 7 def value @value end |