Class: Takagi::Router::RouteEntry
- Inherits:
-
Object
- Object
- Takagi::Router::RouteEntry
- Defined in:
- lib/takagi/router.rb
Overview
Represents a registered route with its handler and CoRE Link Format metadata
Instance Attribute Summary collapse
-
#attribute_set ⇒ Object
readonly
Returns the value of attribute attribute_set.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Instance Method Summary collapse
-
#configure_attributes(&block) ⇒ Object
Configure CoRE Link Format attributes using DSL block.
-
#initialize(method:, path:, block:, metadata: {}, receiver: nil) ⇒ RouteEntry
constructor
A new instance of RouteEntry.
-
#initialize_copy(original) ⇒ Object
Support for dup operation (used in discovery).
-
#metadata ⇒ Object
Returns the underlying metadata hash for backward compatibility.
Constructor Details
#initialize(method:, path:, block:, metadata: {}, receiver: nil) ⇒ RouteEntry
Returns a new instance of RouteEntry.
37 38 39 40 41 42 43 |
# File 'lib/takagi/router.rb', line 37 def initialize(method:, path:, block:, metadata: {}, receiver: nil) @method = method @path = path @block = block @receiver = receiver @attribute_set = Core::AttributeSet.new() end |
Instance Attribute Details
#attribute_set ⇒ Object (readonly)
Returns the value of attribute attribute_set.
35 36 37 |
# File 'lib/takagi/router.rb', line 35 def attribute_set @attribute_set end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
35 36 37 |
# File 'lib/takagi/router.rb', line 35 def block @block end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
35 36 37 |
# File 'lib/takagi/router.rb', line 35 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
35 36 37 |
# File 'lib/takagi/router.rb', line 35 def path @path end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
35 36 37 |
# File 'lib/takagi/router.rb', line 35 def receiver @receiver end |
Instance Method Details
#configure_attributes(&block) ⇒ Object
Configure CoRE Link Format attributes using DSL block
58 59 60 61 |
# File 'lib/takagi/router.rb', line 58 def configure_attributes(&block) @attribute_set.core(&block) @attribute_set.apply! end |
#initialize_copy(original) ⇒ Object
Support for dup operation (used in discovery)
64 65 66 67 |
# File 'lib/takagi/router.rb', line 64 def initialize_copy(original) super @attribute_set = Core::AttributeSet.new(original..dup) end |
#metadata ⇒ Object
Returns the underlying metadata hash for backward compatibility
46 47 48 |
# File 'lib/takagi/router.rb', line 46 def @attribute_set. end |