Class: Calendrier::Item
- Inherits:
-
Object
- Object
- Calendrier::Item
- Defined in:
- lib/calendrier/item.rb
Instance Attribute Summary collapse
-
#obj ⇒ Object
Returns the value of attribute obj.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(obj, options = {}) ⇒ Item
constructor
A new instance of Item.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to?(method, include_private = false) ⇒ Boolean
Constructor Details
#initialize(obj, options = {}) ⇒ Item
Returns a new instance of Item.
5 6 7 8 |
# File 'lib/calendrier/item.rb', line 5 def initialize(obj, = {}) self.obj = obj self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/calendrier/item.rb', line 10 def method_missing(method, *args, &block) ret = nil unless obj.nil? if .include?(:field) ret = obj.send([:field]).send(method) elsif ![method].nil? if [method].is_a?(Symbol) ret = obj.send([method]) else ret = [method] end elsif obj.respond_to?(method) ret = obj.send(method) end end ret end |
Instance Attribute Details
#obj ⇒ Object
Returns the value of attribute obj.
3 4 5 |
# File 'lib/calendrier/item.rb', line 3 def obj @obj end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/calendrier/item.rb', line 3 def @options end |
Instance Method Details
#respond_to?(method, include_private = false) ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/calendrier/item.rb', line 30 def respond_to?(method, include_private = false) ret = true begin self.send(method) rescue NoMethodError ret = false end ret end |