Module: HumanValue

Defined in:
lib/human_value.rb,
lib/human_value/value.rb,
lib/human_value/helpers.rb,
lib/human_value/version.rb,
lib/human_value/humanization.rb,
lib/human_value/extensions/naming.rb,
lib/human_value/integration/rails.rb,
lib/human_value/extensions/carrierwave.rb

Defined Under Namespace

Modules: Extensions, Helpers Classes: Humanization, Railtie, Value

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.enable_extension(extension_name) ⇒ Object



20
21
22
23
24
# File 'lib/human_value.rb', line 20

def self.enable_extension(extension_name)
  "HumanValue::Extensions::#{extension_name.to_s.classify}".constantize.load
rescue NameError
  raise "Unknown extension '#{extension_name}'"
end

.humanizationsObject



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

def self.humanizations
  @humanizations ||= []
end

.humanize(type, options = {}, &block) ⇒ Object



15
16
17
18
# File 'lib/human_value.rb', line 15

def self.humanize(type, options = {}, &block)
  modifier = options[:prepend] ? :unshift : :push
  humanizations.public_send modifier, Humanization.new(type).instance_eval(&block)
end