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.
20 21 22 23 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 20 def initialize @nodes = {} # @cache_key = false end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
18 19 20 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 18 def data @data end |
#nodes ⇒ Object
Returns the value of attribute nodes.
18 19 20 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 18 def nodes @nodes end |
#root_name ⇒ Object
Returns the value of attribute root_name.
18 19 20 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 18 def root_name @root_name end |
Instance Method Details
#add(n) ⇒ Object
def initialize_dup(other) super self.nodes = other.nodes.dup end
34 35 36 37 38 39 40 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 34 def add(n) if n[:attr] && n[:name] != n[:attr] n[:name] = "#{n[:name]}(#{n[:attr]})" end @nodes[n[:name]] = Node.new(n[:name], n[:attr], n[:nested]) end |
#each(&block) ⇒ Object
25 26 27 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 25 def each(&block) @nodes.each &block end |
#extends(template) ⇒ Object
42 43 44 |
# File 'lib/rails_api_doc/controller/response/rabl_compiler.rb', line 42 def extends(template) @nodes.merge! template.nodes end |