Class: StoreAsInt::Money

Inherits:
Base
  • Object
show all
Defined in:
lib/store_as_int/money.rb

Constant Summary collapse

ACCURACY =

Constants ============================================================

2
DECIMALS =
2
SYM =
'$'

Instance Attribute Summary

Attributes inherited from Base

#num

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, #==, ===, #===, accuracy, #accuracy, #as_json, base, #base, #base_float, #coerce, #convert, decimals, #decimals, #dup, #duplicable?, hash_without_keys, #initialize, #inspect, #instance_of?, #is_a?, #is_an?, json_create, #kind_of?, #matcher, matcher, #method_missing, #negative_sign, #operators, operators, #present?, str_format, sym, #sym, #sym=, #to_d, #to_f, #to_h, #to_i, #to_json, #to_s, #value

Constructor Details

This class inherits a constructor from StoreAsInt::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class StoreAsInt::Base

Class Method Details

.extend_numericsObject

Class Methods ========================================================



20
21
22
# File 'lib/store_as_int/money.rb', line 20

def self.extend_numerics
  Numeric.include StoreAsInt::ActsAsMoneyInt
end

Instance Method Details

#dollar_str(padding: 0) ⇒ Object

Instance Methods =====================================================



28
29
30
# File 'lib/store_as_int/money.rb', line 28

def dollar_str(padding: 0)
  to_s(true, padding: padding.to_i)
end

#to_centsObject



32
33
34
# File 'lib/store_as_int/money.rb', line 32

def to_cents
  self
end