Class: Droutes::ClassStruct
- Inherits:
-
Object
- Object
- Droutes::ClassStruct
- Defined in:
- lib/droutes/parser.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#docs ⇒ Object
readonly
Returns the value of attribute docs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #add_to_path(struct) ⇒ Object
-
#initialize(class_name, docs = "") ⇒ ClassStruct
constructor
A new instance of ClassStruct.
Constructor Details
#initialize(class_name, docs = "") ⇒ ClassStruct
Returns a new instance of ClassStruct.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/droutes/parser.rb', line 5 def initialize(class_name, docs="") @name = class_name if class_name controller = class_name.underscore @controller = controller[0, controller.length - "_controller".length] end @paths = ::Hash.new { |h, k| h[k] = {} } @children = [] @docs = docs || "" end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/droutes/parser.rb', line 3 def children @children end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/droutes/parser.rb', line 3 def controller @controller end |
#docs ⇒ Object (readonly)
Returns the value of attribute docs.
3 4 5 |
# File 'lib/droutes/parser.rb', line 3 def docs @docs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/droutes/parser.rb', line 3 def name @name end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
3 4 5 |
# File 'lib/droutes/parser.rb', line 3 def paths @paths end |
Instance Method Details
#add_to_path(struct) ⇒ Object
16 17 18 |
# File 'lib/droutes/parser.rb', line 16 def add_to_path(struct) @paths[struct.path][struct.action] = struct end |