Module: Crabfarm::Assertion::Fields
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Context
Class Method Details
.included(klass) ⇒ Object
65 66 67 |
# File 'lib/crabfarm/assertion/fields.rb', line 65 def self.included(klass) klass.extend ClassMethods end |
Instance Method Details
#attributes=(_hash) ⇒ Object
79 80 81 |
# File 'lib/crabfarm/assertion/fields.rb', line 79 def attributes=(_hash) _hash.each { |k,v| send(k.to_s+'=', v) } end |
#field_hash ⇒ Object
87 88 89 |
# File 'lib/crabfarm/assertion/fields.rb', line 87 def field_hash @field_hash end |
#mock(_hash) ⇒ Object
83 84 85 |
# File 'lib/crabfarm/assertion/fields.rb', line 83 def mock(_hash) @field_hash = _hash end |
#reset_fields ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/crabfarm/assertion/fields.rb', line 69 def reset_fields klass = self.class @field_hash = {} klass.fields.each do |field| value = klass.field_defaults[field] @field_hash[field] = value.duplicable? ? value.clone : value end end |