Sha256: 04f534e5b9cb6a228b238373d3e8454e63d47e1950eb69ec33819ffec4794084

Contents?: true

Size: 563 Bytes

Versions: 5

Compression:

Stored size: 563 Bytes

Contents

module IEX
  module Resources
    class Resource < Hashie::Trash
      include Hashie::Extensions::IgnoreUndeclared

      def self.float_to_percentage(float_number)
        return unless float_number.is_a? Numeric
        return '+0.00%' if float_number.zero?

        [
          float_number.positive? ? '+' : '',
          format('%.2f', float_number * 100),
          '%'
        ].join
      end

      def self.to_dollar(amount:, ignore_cents: true)
        MoneyHelper.money_to_text(amount, 'USD', nil, no_cents: ignore_cents)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iex-ruby-client-1.3.0 lib/iex/resources/resource.rb
iex-ruby-client-1.2.0 lib/iex/resources/resource.rb
iex-ruby-client-1.1.2 lib/iex/resources/resource.rb
iex-ruby-client-1.1.1 lib/iex/resources/resource.rb
iex-ruby-client-1.1.0 lib/iex/resources/resource.rb