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