Class: Chronicles::Updater
- Inherits:
-
Object
- Object
- Chronicles::Updater
- Defined in:
- lib/chronicles/updater.rb
Overview
Reloads object method
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(object, name, code = nil) ⇒ Updater
constructor
A new instance of Updater.
- #klass ⇒ Object
- #run ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(object, name, code = nil) ⇒ Updater
Returns a new instance of Updater.
10 11 12 13 14 15 |
# File 'lib/chronicles/updater.rb', line 10 def initialize(object, name, code = nil) @object = object @name = name @code = code type end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/chronicles/updater.rb', line 17 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/chronicles/updater.rb', line 17 def name @name end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
17 18 19 |
# File 'lib/chronicles/updater.rb', line 17 def object @object end |
Instance Method Details
#klass ⇒ Object
25 26 27 |
# File 'lib/chronicles/updater.rb', line 25 def klass object.singleton_class end |
#run ⇒ Object
29 30 31 32 |
# File 'lib/chronicles/updater.rb', line 29 def run redefine_method protect_method end |
#type ⇒ Object
19 20 21 22 23 |
# File 'lib/chronicles/updater.rb', line 19 def type @type ||= %w(public private protected).detect do |item| object.public_send("#{ item }_methods").include? name end end |