Module: Ion::Helpers

Included in:
Scope
Defined in:
lib/ion/helpers.rb

Instance Method Summary collapse

Instance Method Details

#yieldie(to = self, &blk) ⇒ Object

Replacement for instance_eval for DSL stuff

Examples:


yieldie(search) { |q| q.text :title, "hi" }
yieldie(search) { text :title, "hi" }


8
9
10
# File 'lib/ion/helpers.rb', line 8

def yieldie(to=self, &blk)
  (blk.arity > 0) ? yield(to) : to.instance_eval(&blk)
end