Class: Breeze::ChangeSet
- Inherits:
-
Object
- Object
- Breeze::ChangeSet
- Defined in:
- app/models/breeze/change_set.rb
Instance Attribute Summary collapse
-
#adds ⇒ Object
readonly
Returns the value of attribute adds.
-
#deletes ⇒ Object
readonly
Returns the value of attribute deletes.
-
#edits ⇒ Object
readonly
Returns the value of attribute edits.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#last_editor ⇒ Object
readonly
Returns the value of attribute last_editor.
Class Method Summary collapse
Instance Method Summary collapse
- #add(type, text, editor) ⇒ Object
- #added(type) ⇒ Object
- #delete(type, text, editor) ⇒ Object
- #deleted(type) ⇒ Object
- #edit(type, text, editor) ⇒ Object
- #edited(type) ⇒ Object
-
#initialize ⇒ ChangeSet
constructor
A new instance of ChangeSet.
- #touch(editor) ⇒ Object
- #typed(class_name) ⇒ Object
- #zero ⇒ Object
Constructor Details
#initialize ⇒ ChangeSet
Returns a new instance of ChangeSet.
10 11 12 |
# File 'app/models/breeze/change_set.rb', line 10 def initialize zero end |
Instance Attribute Details
#adds ⇒ Object (readonly)
Returns the value of attribute adds.
8 9 10 |
# File 'app/models/breeze/change_set.rb', line 8 def adds @adds end |
#deletes ⇒ Object (readonly)
Returns the value of attribute deletes.
8 9 10 |
# File 'app/models/breeze/change_set.rb', line 8 def deletes @deletes end |
#edits ⇒ Object (readonly)
Returns the value of attribute edits.
8 9 10 |
# File 'app/models/breeze/change_set.rb', line 8 def edits @edits end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
8 9 10 |
# File 'app/models/breeze/change_set.rb', line 8 def last @last end |
#last_editor ⇒ Object (readonly)
Returns the value of attribute last_editor.
8 9 10 |
# File 'app/models/breeze/change_set.rb', line 8 def last_editor @last_editor end |
Class Method Details
Instance Method Details
#add(type, text, editor) ⇒ Object
27 28 29 30 |
# File 'app/models/breeze/change_set.rb', line 27 def add( type , text , editor) touch(editor) @adds << [typed(type) , text ] end |
#added(type) ⇒ Object
41 42 43 44 |
# File 'app/models/breeze/change_set.rb', line 41 def added( type ) type = type.to_sym @adds.select { |a| a.first == type } end |
#delete(type, text, editor) ⇒ Object
36 37 38 39 |
# File 'app/models/breeze/change_set.rb', line 36 def delete( type , text, editor) touch(editor) @deletes << [typed(type) , text ] end |
#deleted(type) ⇒ Object
49 50 51 52 |
# File 'app/models/breeze/change_set.rb', line 49 def deleted( type ) type = type.to_sym @deletes.select { |a| a.first == type } end |
#edit(type, text, editor) ⇒ Object
32 33 34 35 |
# File 'app/models/breeze/change_set.rb', line 32 def edit( type , text, editor) touch(editor) @edits << [typed(type) , text ] end |
#edited(type) ⇒ Object
45 46 47 48 |
# File 'app/models/breeze/change_set.rb', line 45 def edited( type ) type = type.to_sym @edits.select { |a| a.first == type } end |
#touch(editor) ⇒ Object
22 23 24 25 |
# File 'app/models/breeze/change_set.rb', line 22 def touch(editor) @last = Time.now @last_editor = editor end |
#typed(class_name) ⇒ Object
54 55 56 |
# File 'app/models/breeze/change_set.rb', line 54 def typed(class_name) class_name.split("::").last.to_sym end |
#zero ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/models/breeze/change_set.rb', line 14 def zero @adds = Set.new @edits = Set.new @deletes = Set.new @last = nil @last_editor = nil end |