Class: Class
- Defined in:
- lib/delayed/performable_method.rb,
lib/passive_support/core_ext/class/attribute_accessors.rb
Instance Method Summary collapse
- #cattr_accessor(*syms) ⇒ Object
- #cattr_reader(*syms) ⇒ Object
- #cattr_writer(*syms) ⇒ Object
- #dump_for_delayed_job ⇒ Object
- #extract_options!(array) ⇒ Object
- #load_for_delayed_job(arg) ⇒ Object
Instance Method Details
#cattr_accessor(*syms) ⇒ Object
49 50 51 52 |
# File 'lib/passive_support/core_ext/class/attribute_accessors.rb', line 49 def cattr_accessor(*syms) cattr_reader(*syms) cattr_writer(*syms) end |
#cattr_reader(*syms) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/passive_support/core_ext/class/attribute_accessors.rb', line 2 def cattr_reader(* syms) = (syms) syms.each do |sym| next if sym.is_a?(Hash) class_eval(<<-EOS, __FILE__, __LINE__ + 1) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym} @@#{sym} end EOS unless [:instance_reader] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym} @@#{sym} end EOS end end end |
#cattr_writer(*syms) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/passive_support/core_ext/class/attribute_accessors.rb', line 26 def cattr_writer(* syms) = (syms) syms.each do |sym| class_eval(<<-EOS, __FILE__, __LINE__ + 1) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym}=(obj) @@#{sym} = obj end EOS unless [:instance_writer] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym}=(obj) @@#{sym} = obj end EOS end end end |
#dump_for_delayed_job ⇒ Object
6 7 8 |
# File 'lib/delayed/performable_method.rb', line 6 def dump_for_delayed_job name end |
#extract_options!(array) ⇒ Object
54 55 56 |
# File 'lib/passive_support/core_ext/class/attribute_accessors.rb', line 54 def (array) array.last.is_a?(::Hash) ? array.pop : {} end |
#load_for_delayed_job(arg) ⇒ Object
2 3 4 |
# File 'lib/delayed/performable_method.rb', line 2 def load_for_delayed_job(arg) self end |