Class: VeiculoStrans
- Inherits:
-
Object
- Object
- VeiculoStrans
- Defined in:
- lib/veiculo.rb
Instance Attribute Summary collapse
-
#codigoVeiculo ⇒ Object
Returns the value of attribute codigoVeiculo.
-
#hora ⇒ Object
Returns the value of attribute hora.
-
#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) ⇒ VeiculoStrans
constructor
A new instance of VeiculoStrans.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(fields) ⇒ VeiculoStrans
Returns a new instance of VeiculoStrans.
5 6 7 8 9 10 11 12 |
# File 'lib/veiculo.rb', line 5 def initialize(fields) if(fields) @codigoVeiculo = fields['CodigoVeiculo'] || fields[:codigoVeiculo] @hora = fields['Hora'] || fields[:hora] @lat = (fields['Lat'] || fields[:lat]).to_f @long = (fields['Long'] || fields[:long]).to_f end end |
Instance Attribute Details
#codigoVeiculo ⇒ Object
Returns the value of attribute codigoVeiculo.
3 4 5 |
# File 'lib/veiculo.rb', line 3 def codigoVeiculo @codigoVeiculo end |
#hora ⇒ Object
Returns the value of attribute hora.
3 4 5 |
# File 'lib/veiculo.rb', line 3 def hora @hora end |
#lat ⇒ Object
Returns the value of attribute lat.
3 4 5 |
# File 'lib/veiculo.rb', line 3 def lat @lat end |
#linha ⇒ Object
Returns the value of attribute linha.
3 4 5 |
# File 'lib/veiculo.rb', line 3 def linha @linha end |
#long ⇒ Object
Returns the value of attribute long.
3 4 5 |
# File 'lib/veiculo.rb', line 3 def long @long end |
Instance Method Details
#to_json(*a) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/veiculo.rb', line 14 def to_json(*a) serialized = {} serialized[:codigoVeiculo] = @codigoVeiculo if @codigoVeiculo serialized[:hora] = @hora if @hora serialized[:lat] = @lat if @lat serialized[:long] = @long if @long serialized.to_json *a end |