Module: Transformers
- Defined in:
- lib/transformers.rb,
lib/transformers/boolean.rb,
lib/transformers/version.rb,
lib/transformers/method_call.rb,
lib/transformers/missing_option.rb,
lib/transformers/extensions/hash.rb,
lib/transformers/unknown_transformer.rb,
lib/transformers/extensions/action_controller.rb
Defined Under Namespace
Modules: Boolean, Extensions
Classes: MethodCall, MissingOption, UnknownTransformer
Constant Summary
collapse
- STANDARD =
{ :boolean => Transformers::Boolean }.freeze
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.all ⇒ Object
16
17
18
|
# File 'lib/transformers.rb', line 16
def self.all
custom.merge(STANDARD)
end
|
.custom ⇒ Object
12
13
14
|
# File 'lib/transformers.rb', line 12
def self.custom
@custom ||= {}
end
|
.get(transformer) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/transformers.rb', line 20
def self.get(transformer)
case transformer
when Module, Proc
transformer
when Symbol
all.has_key?(transformer) ? all[transformer] : MethodCall.new(transformer)
else
raise UnknownTransformer.new(transformer)
end
end
|
.register(name, transformer) ⇒ Object
31
32
33
|
# File 'lib/transformers.rb', line 31
def self.register(name, transformer)
custom[name] = transformer
end
|