Sha256: d7e45dfee334c3535abac2fb698461e5dc1c1e9feaae4827fe60829258313f93

Contents?: true

Size: 442 Bytes

Versions: 2

Compression:

Stored size: 442 Bytes

Contents

module Medidas
  class DerivedUnit < Unit
    attr_reader :base_unit
    attr_reader :factor

    def self.[](name, plural: "#{name}s", base_unit:, factor: 1)
      registered_units[name] ||= new(name: name, plural: plural, base_unit: base_unit, factor: factor)
    end

    def initialize(name:, plural:, base_unit:, factor: )
      @name   = name
      @plural = plural
      @base_unit = base_unit
      @factor = factor
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
medidas-0.1.1 lib/medidas/derived_unit.rb
medidas-0.1.0 lib/medidas/derived_unit.rb