Module: WithExpectations
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/with_expectations.rb
Instance Method Summary collapse
- #expectations ⇒ Object
- #expectations=(expectations) ⇒ Object
- #expectations_yaml ⇒ Object
- #expectations_yaml=(yaml) ⇒ Object
Instance Method Details
#expectations ⇒ Object
20 21 22 |
# File 'app/models/concerns/with_expectations.rb', line 20 def expectations self[:expectations] || [] end |
#expectations=(expectations) ⇒ Object
16 17 18 |
# File 'app/models/concerns/with_expectations.rb', line 16 def expectations=(expectations) self[:expectations] = expectations.map(&:stringify_keys) end |
#expectations_yaml ⇒ Object
8 9 10 |
# File 'app/models/concerns/with_expectations.rb', line 8 def expectations_yaml self.expectations.to_yaml end |
#expectations_yaml=(yaml) ⇒ Object
12 13 14 |
# File 'app/models/concerns/with_expectations.rb', line 12 def expectations_yaml=(yaml) self.expectations = YAML.load yaml end |