Module: Amiando::Autorun::ClassMethods
- Defined in:
- lib/amiando/autorun.rb
Instance Method Summary collapse
Instance Method Details
#autorun(*fields) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/amiando/autorun.rb', line 8 def autorun(*fields) fields.each do |field| class_eval <<-EOS, __FILE__, __LINE__ def #{field} Amiando.run if Amiando.autorun && !defined?(@#{field}) if defined?(@#{field}) @#{field} else raise Error::NotInitialized.new('Called result before the query was run') end end EOS end end |