Module: DHS::Data::Becomes
- Extended by:
- ActiveSupport::Concern
- Included in:
- DHS::Data
- Defined in:
- lib/dhs/concerns/data/becomes.rb
Instance Method Summary collapse
Instance Method Details
#becomes(klass, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dhs/concerns/data/becomes.rb', line 10 def becomes(klass, = {}) return self if self.instance_of?(klass) && !is_a?(DHS::Data) data = DHS::Data.new(_raw, _parent, klass) data.errors = [:errors] if [:errors] data.warnings = [:warnings] if [:warnings] klass.new(data) end |