Class: Tantot::Changes::ByModel
- Inherits:
-
Object
- Object
- Tantot::Changes::ByModel
- Includes:
- Enumerable
- Defined in:
- lib/tantot/changes.rb
Instance Attribute Summary collapse
-
#changes_by_model ⇒ Object
readonly
Returns the value of attribute changes_by_model.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](model) ⇒ Object
- #each(&block) ⇒ Object
- #for_model(model) ⇒ Object
-
#initialize(changes_by_model) ⇒ ByModel
constructor
A new instance of ByModel.
Constructor Details
#initialize(changes_by_model) ⇒ ByModel
Returns a new instance of ByModel.
37 38 39 |
# File 'lib/tantot/changes.rb', line 37 def initialize(changes_by_model) @changes_by_model = changes_by_model end |
Instance Attribute Details
#changes_by_model ⇒ Object (readonly)
Returns the value of attribute changes_by_model.
35 36 37 |
# File 'lib/tantot/changes.rb', line 35 def changes_by_model @changes_by_model end |
Instance Method Details
#==(other) ⇒ Object
44 45 46 |
# File 'lib/tantot/changes.rb', line 44 def ==(other) other.changes_by_model == @changes_by_model end |
#[](model) ⇒ Object
48 49 50 |
# File 'lib/tantot/changes.rb', line 48 def [](model) for_model(model) end |
#each(&block) ⇒ Object
52 53 54 55 56 |
# File 'lib/tantot/changes.rb', line 52 def each(&block) @changes_by_model.each do |model, changes| block.call(model, Tantot::Changes::ById.new(changes)) end end |
#for_model(model) ⇒ Object
58 59 60 |
# File 'lib/tantot/changes.rb', line 58 def for_model(model) Tantot::Changes::ById.new(@changes_by_model[model]) end |