Sha256: f962ce921e3283b74de62b56122521eb8e2ee696d6b4c7c2a0a86b902c2e62e2

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

# encoding: utf-8

module FFaker
  module Vehicle
    extend ModuleUtils
    extend self

    DRIVETRAINS = %w(4WD 4X4 AWD FWD RWD)
    YEARS = [*'1900'.."#{Date.today.year+1}"]
    COLOR_PREFIXES = k(%w(
      beautiful bright calm dangerous dark dull fast magnetic magnificent majestic melodic metallic
      mundane mute mysterious new pleasant pretty resonant royal slate soft tranquil vibrant weak
    ))

    def base_color
      FFaker::Color.name
    end

    def drivetrain
      DRIVETRAINS.sample
    end

    def make
      MAKES_LIST.sample
    end

    def manufacturer_color(n=2)
      # Take two prefixes because it's more fun than one
      (COLOR_PREFIXES.sample(n) + [base_color]).join(' ')
    end
    alias_method :mfg_color, :manufacturer_color

    def model
      MODELS_LIST.sample
    end

    def trim
      TRIMS_LIST.sample
    end

    def vin
      FFaker.bothify('1#???#####?######').upcase
    end

    def year
      YEARS.sample
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffaker-2.1.0 lib/ffaker/vehicle.rb