Sha256: c33b8e06ee02ef4bb30d2a0e331e80de758888825b5196dea4b8a71fa049d41e

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

require 'yaml'

module VinExploder
  
  class Explosion
    
    attr_reader :vin, :success, :errors, :make, :model, :year, :driveline, :body_style, :fuel_type, :number_of_doors, :all
    
    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
    
    def valid?
      @success
    end
    alias :success? :valid?
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vin_exploder-0.4.3 lib/vin_exploder/explosion.rb
vin_exploder-0.4.2 lib/vin_exploder/explosion.rb
vin_exploder-0.4.1 lib/vin_exploder/explosion.rb