Sha256: 5a18df5e99699f59f53f552670df62622782b74cf8e63fa4f37a2934be350d45
Contents?: true
Size: 944 Bytes
Versions: 10
Compression:
Stored size: 944 Bytes
Contents
# encoding: utf-8 require 'ostruct' module FFaker module Unit extend ModuleUtils extend self TIME_UNITS = [ { name: 'Years', abbreviation: 'yr' }, { name: 'Days', abbreviation: 'd' }, { name: 'Hours', abbreviation: 'Minutes' }, { name: 'Seconds', abbreviation: 's' }, { name: 'Milliseconds', abbreviation: 'msec' } ].freeze TEMPERATURE_UNITS = [ { name: 'Kelvin', abbreviation: 'K' }, { name: 'Celsius', abbreviation: 'C' }, { name: 'Fahrenheit', abbreviation: 'F' } ].freeze def time_name time.name end def time_abbr time.abbreviation end def temperature_name temperature.name end def temperature_abbr temperature.abbreviation end private def time OpenStruct.new(fetch_sample(TIME_UNITS)) end def temperature OpenStruct.new(fetch_sample(TEMPERATURE_UNITS)) end end end
Version data entries
10 entries across 10 versions & 1 rubygems