Class: CRUDtree::EndNode
- Inherits:
-
Object
- Object
- CRUDtree::EndNode
- Defined in:
- lib/crudtree/tree/endnode.rb
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rest ⇒ Object
readonly
Returns the value of attribute rest.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(parent, params) ⇒ EndNode
constructor
The params Hash takes the following keys:.
Constructor Details
#initialize(parent, params) ⇒ EndNode
The params Hash takes the following keys:
:type may either be member or collection
:path path to this endnode - you can use join or join/:date/:foo/:whatever the interface will handle those parameters. Defaults to call.to_s
:rest which REST method should match this route. Defaults to nil, aka all.
:call The method to be called if this route is matched. Required.
:name The name of this route, used for generating. Symbol. Defaults to call
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/crudtree/tree/endnode.rb', line 26 def initialize(parent, params) @type = params[:type] if [:member, :collection].include? params[:type] raise ArgumentError, "Invalid type: #{params[:type]}" unless @type @call = params[:call] or raise ArgumentError, "No call given." @path = params[:path] || @call.to_s raise ArgumentError, "No path given." unless @path @rest = params[:rest] @name = params[:name] || @call @parent = parent end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def call @call end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def path @path end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def rest @rest end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
37 38 39 |
# File 'lib/crudtree/tree/endnode.rb', line 37 def type @type end |