Module: Shrink::Wrap::ClassMethods
- Defined in:
- lib/shrink/wrap.rb
Instance Method Summary collapse
- #coerce(opts = {}) ⇒ Object
- #shrink_wrap(data) ⇒ Object
- #transform(klass, opts = {}) ⇒ Object
- #translate(opts = {}) ⇒ Object
- #translate_all ⇒ Object
Instance Method Details
#coerce(opts = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/shrink/wrap.rb', line 26 def coerce(opts = {}) opts.each do |key, value| .add_coercion(key, value) end end |
#shrink_wrap(data) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/shrink/wrap.rb', line 32 def shrink_wrap(data) transformed = .transform(data) translated = .translate(transformed) coerced = .coerce(translated) new(coerced) end |
#transform(klass, opts = {}) ⇒ Object
12 13 14 |
# File 'lib/shrink/wrap.rb', line 12 def transform(klass, opts = {}) .add_transformer(klass, opts) end |
#translate(opts = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/shrink/wrap.rb', line 16 def translate(opts = {}) opts.each do |key, value| .add_translation(key, value) end end |
#translate_all ⇒ Object
22 23 24 |
# File 'lib/shrink/wrap.rb', line 22 def translate_all .translate_all! end |