Class: Metromobilite::Model::Pattern
- Inherits:
-
Object
- Object
- Metromobilite::Model::Pattern
- Defined in:
- lib/metromobilite/model/pattern.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#shortDesc ⇒ Object
readonly
Returns the value of attribute shortDesc.
Instance Method Summary collapse
-
#initialize(jsonData) ⇒ Pattern
constructor
Initializes a new Metromobilite::Pattern object.
- #to_json(opts = nil) ⇒ Object
Constructor Details
#initialize(jsonData) ⇒ Pattern
Initializes a new Metromobilite::Pattern object
jsonData_Hash
-
The JSON data received and parsed as a Hash
11 12 13 14 15 16 17 |
# File 'lib/metromobilite/model/pattern.rb', line 11 def initialize(jsonData) @id = jsonData['id'] @desc = jsonData['desc'] @dir = jsonData['dir'] @shortDesc = jsonData['shortDesc'] end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
20 21 22 |
# File 'lib/metromobilite/model/pattern.rb', line 20 def desc @desc end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
21 22 23 |
# File 'lib/metromobilite/model/pattern.rb', line 21 def dir @dir end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19 20 21 |
# File 'lib/metromobilite/model/pattern.rb', line 19 def id @id end |
#shortDesc ⇒ Object (readonly)
Returns the value of attribute shortDesc.
22 23 24 |
# File 'lib/metromobilite/model/pattern.rb', line 22 def shortDesc @shortDesc end |
Instance Method Details
#to_json(opts = nil) ⇒ Object
24 25 26 27 28 |
# File 'lib/metromobilite/model/pattern.rb', line 24 def to_json(opts = nil) hash = {} instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) } hash.to_json end |