Class: PopCap::FormattedHash

Inherits:
Object
  • Object
show all
Defined in:
lib/pop_cap/formatted_hash.rb

Overview

Public: This class will apply all Formatters to the supplied hash.

new - Supply an unformatted hash.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unformatted) ⇒ FormattedHash

Returns a new instance of FormattedHash.



11
12
13
# File 'lib/pop_cap/formatted_hash.rb', line 11

def initialize(unformatted)
  @unformatted = unformatted
end

Class Method Details

.formatted(unformatted) ⇒ Object

Public: This wraps #new & #formatted.



24
25
26
# File 'lib/pop_cap/formatted_hash.rb', line 24

def self.formatted(unformatted)
  new(unformatted).formatted
end

Instance Method Details

#formattedObject

Public: This class will apply all Formatters to the supplied hash.



18
19
20
# File 'lib/pop_cap/formatted_hash.rb', line 18

def formatted
  @unformatted.merge(formatted_hash)
end