Sha256: ba827b2bb4d5f31df978e18563678a930d6192eeadaa584dac0fee6c36f9e4b3

Contents?: true

Size: 602 Bytes

Versions: 25

Compression:

Stored size: 602 Bytes

Contents

module GreenButtonData
  module Parser
    class RationalNumber
      include SAXMachine

      element :numerator, class: Integer
      element :denominator, class: Integer

      def to_f
        @numerator / @denominator
      end

      # ESPI Namespacing
      element :'espi:numerator', class: Integer, as: :numerator
      element :'espi:denominator', class: Integer, as: :denominator

      # Special case for PG&E which uses generic namespacing
      element :'ns0:numerator', class: Integer, as: :numerator
      element :'ns0:denominator', class: Integer, as: :denominator
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
green-button-data-2.0.1 lib/green-button-data/parser/rational_number.rb
green-button-data-2.0.0 lib/green-button-data/parser/rational_number.rb
green-button-data-1.0.3 lib/green-button-data/parser/rational_number.rb
green-button-data-1.0.1 lib/green-button-data/parser/rational_number.rb
green-button-data-1.0.0 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.5 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.4 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.3 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.2 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.1 lib/green-button-data/parser/rational_number.rb
green-button-data-0.7.0 lib/green-button-data/parser/rational_number.rb
green-button-data-0.6.0 lib/green-button-data/parser/rational_number.rb
green-button-data-0.5.0 lib/green-button-data/parser/rational_number.rb
green-button-data-0.4.2 lib/green-button-data/parser/rational_number.rb
green-button-data-0.4.1 lib/green-button-data/parser/rational_number.rb
green-button-data-0.3.2 lib/green-button-data/parser/rational_number.rb
green-button-data-0.4.0 lib/green-button-data/parser/rational_number.rb
green-button-data-0.4.0.alpha.pre.1 lib/green-button-data/parser/rational_number.rb
green-button-data-0.3.1 lib/green-button-data/parser/rational_number.rb
green-button-data-0.3.0 lib/green-button-data/parser/rational_number.rb