Class: Gutentag::ChangeState
- Inherits:
-
Object
- Object
- Gutentag::ChangeState
- Defined in:
- lib/gutentag/change_state.rb
Instance Attribute Summary collapse
-
#normaliser ⇒ Object
writeonly
Sets the attribute normaliser.
-
#taggable ⇒ Object
readonly
Returns the value of attribute taggable.
Instance Method Summary collapse
- #added ⇒ Object
-
#initialize(taggable) ⇒ ChangeState
constructor
A new instance of ChangeState.
- #removed ⇒ Object
Constructor Details
#initialize(taggable) ⇒ ChangeState
Returns a new instance of ChangeState.
7 8 9 10 11 |
# File 'lib/gutentag/change_state.rb', line 7 def initialize(taggable) @taggable = taggable @existing = normalised taggable..collect(&:name) @changes = normalised taggable.tag_names end |
Instance Attribute Details
#normaliser=(value) ⇒ Object
Sets the attribute normaliser
5 6 7 |
# File 'lib/gutentag/change_state.rb', line 5 def normaliser=(value) @normaliser = value end |
#taggable ⇒ Object (readonly)
Returns the value of attribute taggable.
4 5 6 |
# File 'lib/gutentag/change_state.rb', line 4 def taggable @taggable end |
Instance Method Details
#added ⇒ Object
13 14 15 |
# File 'lib/gutentag/change_state.rb', line 13 def added @added ||= changes - existing end |
#removed ⇒ Object
17 18 19 |
# File 'lib/gutentag/change_state.rb', line 17 def removed @removed ||= existing - changes end |