Class: ParadaStrans
- Inherits:
-
Object
- Object
- ParadaStrans
- Defined in:
- lib/parada.rb
Instance Attribute Summary collapse
-
#codigoParada ⇒ Object
Returns the value of attribute codigoParada.
-
#denominacao ⇒ Object
Returns the value of attribute denominacao.
-
#dist ⇒ Object
Returns the value of attribute dist.
-
#endereco ⇒ Object
Returns the value of attribute endereco.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#linha ⇒ Object
Returns the value of attribute linha.
-
#long ⇒ Object
Returns the value of attribute long.
Instance Method Summary collapse
-
#initialize(fields) ⇒ ParadaStrans
constructor
A new instance of ParadaStrans.
- #load_atts(fields) ⇒ Object
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(fields) ⇒ ParadaStrans
5 6 7 |
# File 'lib/parada.rb', line 5 def initialize(fields) load_atts(fields) end |
Instance Attribute Details
#codigoParada ⇒ Object
Returns the value of attribute codigoParada.
9 10 11 |
# File 'lib/parada.rb', line 9 def codigoParada @codigoParada end |
#denominacao ⇒ Object
Returns the value of attribute denominacao.
9 10 11 |
# File 'lib/parada.rb', line 9 def denominacao @denominacao end |
#dist ⇒ Object
Returns the value of attribute dist.
9 10 11 |
# File 'lib/parada.rb', line 9 def dist @dist end |
#endereco ⇒ Object
Returns the value of attribute endereco.
9 10 11 |
# File 'lib/parada.rb', line 9 def endereco @endereco end |
#lat ⇒ Object
Returns the value of attribute lat.
9 10 11 |
# File 'lib/parada.rb', line 9 def lat @lat end |
#linha ⇒ Object
Returns the value of attribute linha.
9 10 11 |
# File 'lib/parada.rb', line 9 def linha @linha end |
#long ⇒ Object
Returns the value of attribute long.
9 10 11 |
# File 'lib/parada.rb', line 9 def long @long end |
Instance Method Details
#load_atts(fields) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/parada.rb', line 11 def load_atts(fields) @codigoParada = fields['CodigoParada'] || fields[:codigoParada] @denominacao = fields['Denomicao'] || fields[:denomicao] @endereco = fields['Endereco'] || fields[:endereco] @lat = (fields['Lat'] || fields[:lat]).to_f @long = (fields['Long'] || fields[:long]).to_f end |
#to_json(*a) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/parada.rb', line 19 def to_json(*a) serialized = {} serialized[:codigoParada] = @codigoParada if @codigoParada serialized[:denominacao] = @denominacao if @denominacao serialized[:endereco] = @endereco if @endereco serialized[:lat] = @lat if @lat serialized[:long] = @long if @long serialized[:dist] = @dist if @dist serialized.to_json(*a) end |