Sha256: a78c34b06de6041d44047033ae43a04bb2db903e599e0b7b7a0eb331b38c941b

Contents?: true

Size: 747 Bytes

Versions: 3

Compression:

Stored size: 747 Bytes

Contents

module Quantify
  module Unit
    module Prefix
      class Base
        
        def self.load(options)
          if options.is_a? Hash
            Prefix.prefixes << self.new(options)
          end
        end

        def self.configure &block
          self.class_eval &block if block
        end

        attr_reader :name, :symbol, :factor

        def initialize(options)
          @symbol = options[:symbol].standardize
          @factor = options[:factor].to_f
          @name = options[:name].standardize.downcase
        end

        def is_si_prefix?
          self.is_a? SI
        end

        def is_non_si_prefix?
          self.is_a? NonSI
        end

        def label
          symbol
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quantify-1.0.5 lib/quantify/unit/prefix/base_prefix.rb
quantify-1.0.4 lib/quantify/unit/prefix/base_prefix.rb
quantify-1.0.3 lib/quantify/unit/prefix/base_prefix.rb