Class: Shrink::Wrap::Property::Translation
- Inherits:
-
Object
- Object
- Shrink::Wrap::Property::Translation
- Includes:
- Support::TypeCheck
- Defined in:
- lib/shrink/wrap/property/translation.rb
Constant Summary collapse
- ATTRIBUTES =
%i[ allow_nil default from ].freeze
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Translation
constructor
A new instance of Translation.
- #translate(opts = {}) ⇒ Object
Methods included from Support::TypeCheck
#ensure_callable!, #ensure_type!
Constructor Details
#initialize(opts = {}) ⇒ Translation
Returns a new instance of Translation.
17 18 19 20 21 |
# File 'lib/shrink/wrap/property/translation.rb', line 17 def initialize(opts = {}) self.allow_nil = opts.fetch(:allow_nil) { false } self.default = opts[:default] self.from = opts.fetch(:from) end |
Instance Method Details
#translate(opts = {}) ⇒ Object
23 24 25 26 |
# File 'lib/shrink/wrap/property/translation.rb', line 23 def translate(opts = {}) ensure_type!(Hash, opts) translate_single(opts) end |