Class: VinExploder::Explosion
- Inherits:
-
Object
- Object
- VinExploder::Explosion
- Defined in:
- lib/vin_exploder/explosion.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
-
#body_style ⇒ Object
readonly
Returns the value of attribute body_style.
-
#driveline ⇒ Object
readonly
Returns the value of attribute driveline.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#fuel_type ⇒ Object
readonly
Returns the value of attribute fuel_type.
-
#make ⇒ Object
readonly
Returns the value of attribute make.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#number_of_doors ⇒ Object
readonly
Returns the value of attribute number_of_doors.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#vin_key ⇒ Object
readonly
Returns the value of attribute vin_key.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(vin, vin_hash, errors = []) ⇒ Explosion
constructor
A new instance of Explosion.
- #valid? ⇒ Boolean (also: #success?)
Constructor Details
#initialize(vin, vin_hash, errors = []) ⇒ Explosion
Returns a new instance of Explosion.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vin_exploder/explosion.rb', line 9 def initialize(vin, vin_hash, errors=[]) @vin = vin @all = vin_hash @make = @all[:make] @model = @all[:model] @year = @all[:year] @driveline = @all[:driveline] @body_style = @all[:body_style] @fuel_type = @all[:fuel_type] @number_of_doors = @all[:number_of_doors] @trim_level = @all[:trim_level] @errors = errors.nil? ? [] : errors @success = @errors.empty? end |
Instance Attribute Details
#all ⇒ Object (readonly)
Returns the value of attribute all.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def all @all end |
#body_style ⇒ Object (readonly)
Returns the value of attribute body_style.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def body_style @body_style end |
#driveline ⇒ Object (readonly)
Returns the value of attribute driveline.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def driveline @driveline end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def errors @errors end |
#fuel_type ⇒ Object (readonly)
Returns the value of attribute fuel_type.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def fuel_type @fuel_type end |
#make ⇒ Object (readonly)
Returns the value of attribute make.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def make @make end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def model @model end |
#number_of_doors ⇒ Object (readonly)
Returns the value of attribute number_of_doors.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def number_of_doors @number_of_doors end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def success @success end |
#vin_key ⇒ Object (readonly)
Returns the value of attribute vin_key.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def vin_key @vin_key end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
7 8 9 |
# File 'lib/vin_exploder/explosion.rb', line 7 def year @year end |
Instance Method Details
#valid? ⇒ Boolean Also known as: success?
24 25 26 |
# File 'lib/vin_exploder/explosion.rb', line 24 def valid? @success end |