Sha256: 36f106289f72b0d9522619c4182241033f46c863b97e20bf7dc1dda4e9bf2087

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

require 'yaml'

module VinExploder
  
  class Explosion
    
    attr_reader :vin, :success, :errors, :make, :model, :year, :driveline, :body_style, :fuel_type, :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]
      @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

2 entries across 2 versions & 1 rubygems

Version Path
vin_exploder-0.3.1 lib/vin_exploder/explosion.rb
vin_exploder-0.3.0 lib/vin_exploder/explosion.rb