Sha256: 1afccb786e622224e5bd5e63ea145ab1cfc7e39ca4eb4409a92fcbfced7b138d
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 Bytes
Contents
module Calendrier class Item attr_accessor :obj, :options def initialize(obj, options = {}) self.obj = obj self.options = options end def method_missing(method, *args, &block) ret = nil unless obj.nil? if options.include?(:field) ret = obj.send(options[:field]).send(method) elsif !options[method].nil? if options[method].is_a?(Symbol) ret = obj.send(options[method]) else ret = options[method] end elsif obj.respond_to?(method) ret = obj.send(method) end end ret end def respond_to?(method, include_private = false) ret = true begin self.send(method) rescue NoMethodError ret = false end ret end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
calendrier-0.9.5 | lib/calendrier/item.rb |
calendrier-0.9.4 | lib/calendrier/item.rb |