Class: PopCap::Formatters::Formatter
- Inherits:
-
Object
- Object
- PopCap::Formatters::Formatter
- Defined in:
- lib/pop_cap/formatter.rb
Overview
Public: This is a super class for all formatter classes. It establishes the default behavior of formatter classes.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.format(value, options = {}) ⇒ Object
Public: A class method for convenience calling of #format.
-
.subclasses ⇒ Object
Public: This returns an array of all subclasses.
-
.subclasses_demodulized ⇒ Object
Public: This returns an array of all subclasses “demodulized.”.
Instance Method Summary collapse
-
#format ⇒ Object
Public: This method contains the handles the formating.
-
#initialize(value, options = {}) ⇒ Formatter
constructor
Public: This class is constructed with a value & options hash.
Constructor Details
#initialize(value, options = {}) ⇒ Formatter
Public: This class is constructed with a value & options hash.
value - The value to be formatted. options - An options hash.
14 15 16 |
# File 'lib/pop_cap/formatter.rb', line 14 def initialize(value, ={}) @value, = value, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/pop_cap/formatter.rb', line 7 def end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/pop_cap/formatter.rb', line 7 def value @value end |
Class Method Details
.format(value, options = {}) ⇒ Object
Public: A class method for convenience calling of #format.
25 26 27 |
# File 'lib/pop_cap/formatter.rb', line 25 def self.format(value, ={}) new(value, ).format end |
.subclasses ⇒ Object
Public: This returns an array of all subclasses.
31 32 33 34 35 36 37 |
# File 'lib/pop_cap/formatter.rb', line 31 def self.subclasses require_all_formatters ObjectSpace.each_object(Class).select do |klass| klass if is_a_subclass?(klass) end.uniq.compact end |
.subclasses_demodulized ⇒ Object
Public: This returns an array of all subclasses “demodulized.”
41 42 43 |
# File 'lib/pop_cap/formatter.rb', line 41 def self.subclasses_demodulized subclasses.map { |klass| demodulize(klass) } end |
Instance Method Details
#format ⇒ Object
Public: This method contains the handles the formating.
20 21 |
# File 'lib/pop_cap/formatter.rb', line 20 def format end |