Class: HALDecorator::Links::Link
- Defined in:
- lib/hal_decorator/links.rb
Instance Attribute Summary collapse
-
#http_method ⇒ Object
readonly
Returns the value of attribute http_method.
Attributes inherited from Property
Instance Method Summary collapse
-
#initialize(rel, value = nil, http_method: nil, &block) ⇒ Link
constructor
A new instance of Link.
- #rel ⇒ Object
Methods inherited from Property
#change_scope, #method_missing, #respond_to_missing?, #value
Constructor Details
#initialize(rel, value = nil, http_method: nil, &block) ⇒ Link
Returns a new instance of Link.
19 20 21 22 23 24 25 |
# File 'lib/hal_decorator/links.rb', line 19 def initialize(rel, value = nil, http_method: nil, &block) if value.nil? && !block_given? raise 'link must be called with non nil value or be given a block' end @http_method = http_method super(rel, value, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class HALDecorator::Property
Instance Attribute Details
#http_method ⇒ Object (readonly)
Returns the value of attribute http_method.
18 19 20 |
# File 'lib/hal_decorator/links.rb', line 18 def http_method @http_method end |
Instance Method Details
#rel ⇒ Object
27 28 29 |
# File 'lib/hal_decorator/links.rb', line 27 def rel name end |