Class: RXSD::ObjectBuilder
- Inherits:
-
Object
- Object
- RXSD::ObjectBuilder
- Defined in:
- lib/rxsd/builder.rb
Overview
Base interface and helper methods to build objects in various formats from specified parameters
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
hash of attribute names / values to assign to class instance attributes.
-
#children ⇒ Object
array of children object builders to construct instances and assign to class instance attributes.
-
#content ⇒ Object
content, for text based data types, will contain text to instantiate object w/ TODO might want at some point to store a bool in ClassBuilder (only set to true in SimpleType) indicating that constructed class is a text based type, for verification purposes.
-
#obj ⇒ Object
actual object built.
-
#parent ⇒ Object
parent object builder, optionally set.
-
#tag_name ⇒ Object
name of class instance to build.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ ObjectBuilder
constructor
Create a new class builder w/ specified args.
Constructor Details
#initialize(args = {}) ⇒ ObjectBuilder
Create a new class builder w/ specified args
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/rxsd/builder.rb', line 131 def initialize(args = {}) if args.has_key? :builder @tag_name = args[:builder].tag_name @content = args[:builder].content @obj = args[:builder].obj @attributes = args[:builder].attributes @children = args[:builder].children @parent = args[:builder].parent else @tag_name = args[:tag_name] @content = args[:content] @obj = args[:obj] @attributes = args[:attributes] @children = args[:children] @parent = args[:parent] end @children = [] if @children.nil? @attributes = [] if @attributes.nil? end |
Instance Attribute Details
#attributes ⇒ Object
hash of attribute names / values to assign to class instance attributes
122 123 124 |
# File 'lib/rxsd/builder.rb', line 122 def attributes @attributes end |
#children ⇒ Object
array of children object builders to construct instances and assign to class instance attributes
125 126 127 |
# File 'lib/rxsd/builder.rb', line 125 def children @children end |
#content ⇒ Object
content, for text based data types, will contain text to instantiate object w/ TODO might want at some point to store a bool in ClassBuilder (only set to true in SimpleType) indicating that constructed class is a text based type, for verification purposes
116 117 118 |
# File 'lib/rxsd/builder.rb', line 116 def content @content end |
#obj ⇒ Object
actual object built
119 120 121 |
# File 'lib/rxsd/builder.rb', line 119 def obj @obj end |
#parent ⇒ Object
parent object builder, optionally set
128 129 130 |
# File 'lib/rxsd/builder.rb', line 128 def parent @parent end |
#tag_name ⇒ Object
name of class instance to build
111 112 113 |
# File 'lib/rxsd/builder.rb', line 111 def tag_name @tag_name end |