Module: WithExpectations

Extended by:
ActiveSupport::Concern
Included in:
Guide, Problem
Defined in:
app/models/concerns/with_expectations.rb

Instance Method Summary collapse

Instance Method Details

#expectationsObject



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_yamlObject



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