Class: VinExploder::Explosion

Inherits:
Object
  • Object
show all
Defined in:
lib/vin_exploder/explosion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#allObject (readonly)

Returns the value of attribute all.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def all
  @all
end

#body_styleObject (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

#drivelineObject (readonly)

Returns the value of attribute driveline.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def driveline
  @driveline
end

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def errors
  @errors
end

#fuel_typeObject (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

#makeObject (readonly)

Returns the value of attribute make.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def make
  @make
end

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def model
  @model
end

#number_of_doorsObject (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

#successObject (readonly)

Returns the value of attribute success.



7
8
9
# File 'lib/vin_exploder/explosion.rb', line 7

def success
  @success
end

#vin_keyObject (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

#yearObject (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?

Returns:

  • (Boolean)


24
25
26
# File 'lib/vin_exploder/explosion.rb', line 24

def valid?
  @success
end