Class: Attribute
- Inherits:
-
Object
- Object
- Attribute
- Defined in:
- lib/parser.rb
Instance Attribute Summary collapse
-
#is_array ⇒ Object
Returns the value of attribute is_array.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(name, type, is_array = false) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name, type, is_array = false) ⇒ Attribute
Returns a new instance of Attribute.
252 253 254 255 256 |
# File 'lib/parser.rb', line 252 def initialize name, type, is_array=false @name = name @type = type @is_array = is_array end |
Instance Attribute Details
#is_array ⇒ Object
Returns the value of attribute is_array.
251 252 253 |
# File 'lib/parser.rb', line 251 def is_array @is_array end |
#name ⇒ Object
Returns the value of attribute name.
251 252 253 |
# File 'lib/parser.rb', line 251 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
251 252 253 |
# File 'lib/parser.rb', line 251 def type @type end |
Instance Method Details
#default_value ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/parser.rb', line 258 def default_value result = nil case @type when "String" result = "\"\"" when "Int" result = 0 when "Double" result = 0.0 when "Bool" result = false end result end |