Class: RailsApiDoc::Controller::Response::CompiledAttributes
- Inherits:
-
Object
- Object
- RailsApiDoc::Controller::Response::CompiledAttributes
- Defined in:
- lib/rails_api_doc/controller/response/rabl_compiler.rb
Overview
template struct
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
-
#root_name ⇒ Object
Returns the value of attribute root_name.
Instance Method Summary collapse
-
#add(n) ⇒ Object
def initialize_dup(other) super self.nodes = other.nodes.dup end.
- #each(&block) ⇒ Object
- #extends(template) ⇒ Object
-
#initialize ⇒ CompiledAttributes
constructor
A new instance of CompiledAttributes.
Constructor Details
#initialize ⇒ CompiledAttributes
Returns a new instance of CompiledAttributes.
11 12 13 14 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 11 def initialize @nodes = {} # @cache_key = false end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 9 def data @data end |
#nodes ⇒ Object
Returns the value of attribute nodes.
9 10 11 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 9 def nodes @nodes end |
#root_name ⇒ Object
Returns the value of attribute root_name.
9 10 11 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 9 def root_name @root_name end |
Instance Method Details
#add(n) ⇒ Object
def initialize_dup(other) super self.nodes = other.nodes.dup end
25 26 27 28 29 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 25 def add(n) n[:name] = "#{n[:name]}(#{n[:attr]})" if n[:attr] && n[:name] != n[:attr] @nodes[n[:name]] = RailsApiDoc::Controller::Response::Param.new(n[:name], n[:attr], n[:nested]) end |
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 16 def each(&block) @nodes.each &block end |
#extends(template) ⇒ Object
31 32 33 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 31 def extends(template) @nodes.merge! template.nodes end |