Class: Picklive::Currency::GBP

Inherits:
Base
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
lib/picklive/currency.rb

Instance Attribute Summary

Attributes inherited from Base

#integer_amount

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#*, #+, #-, #-@, #/, #<=>, #==, [], #abs, #amount, cash?, #eql?, fake?, #for_sentence, #initialize, #inspect, #num_from, #same_type!, #to_f, #to_i, virtual?

Constructor Details

This class inherits a constructor from Picklive::Currency::Base

Class Method Details

.codeObject



97
# File 'lib/picklive/currency.rb', line 97

def self.code         ; 'GBP'  ; end

.html_symbolObject



100
# File 'lib/picklive/currency.rb', line 100

def self.html_symbol  ; '&pound;' ; end

.precisionObject



96
# File 'lib/picklive/currency.rb', line 96

def self.precision    ; 100    ; end

.real?Boolean

Returns:

  • (Boolean)


98
# File 'lib/picklive/currency.rb', line 98

def self.real?        ; true   ; end

.symbolObject



99
# File 'lib/picklive/currency.rb', line 99

def self.symbol       ; '£'    ; end

Instance Method Details

#to_s(options = {}) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/picklive/currency.rb', line 104

def to_s options = {}
  s = number_to_currency(amount, :unit => '£')
  if options[:short]
    if amount < 1.0
      s = "#{integer_amount}p"
    else
      s = s.gsub(/\.0+$/, '')
    end
  end
  s
end