Class: ObservableObject::Watcher::WatcherDetect
- Inherits:
-
Object
- Object
- ObservableObject::Watcher::WatcherDetect
- Defined in:
- lib/observable_object.rb
Constant Summary collapse
- DefaultMethods =
[ :<<, :[]=, :add, :add?, :capitalize!, :chomp!, :chop!, :clear, :collect!, :compact!, :concat, :delete, :delete!, :delete?, :delete_at, :delete_if, :downcase!, :encode!, :gsub!, :fill, :flatten!, :initialize_copy, :insert, :keep_if, :lstrip!, :map!, :merge!, :next!, :pop, :prepend, :push, :rehash, :reject!, :replace, :reverse!, :rotate!, :rstrip!, :scrub!, :select!, :shift, :shuffle!, :slice!, :sort!, :sort_by!, :squeeze!, :store, :strip!, :sub!, :subtract, :succ!, :swapcase!, :tr!, :tr_s!, :uniq!, :unshift, :upcase!, :update ]
- StringExceptionMethods =
doesn’t change the object in case of String
[ :delete ]
Instance Method Summary collapse
-
#initialize(obj) ⇒ WatcherDetect
constructor
A new instance of WatcherDetect.
-
#is_state_changing(obj, mname) ⇒ Object
nothing to do.
- #remember ⇒ Object
Constructor Details
#initialize(obj) ⇒ WatcherDetect
43 44 45 |
# File 'lib/observable_object.rb', line 43 def initialize(obj) @methods = obj.is_a?(String) ? DefaultMethods-StringExceptionMethods : DefaultMethods end |
Instance Method Details
#is_state_changing(obj, mname) ⇒ Object
nothing to do
49 50 51 |
# File 'lib/observable_object.rb', line 49 def is_state_changing(obj,mname) mname.match(/.+\!\z/) || @methods.include?(mname) end |
#remember ⇒ Object
46 47 48 |
# File 'lib/observable_object.rb', line 46 def remember # nothing to do end |