Module: Factrey::Ref::ShorthandMethods
- Included in:
- DSL
- Defined in:
- lib/factrey/ref/shorthand_methods.rb
Overview
Provides shorthand methods for creating Factrey::Refs and Defers.
Instance Method Summary collapse
Instance Method Details
#ref(name = nil) ⇒ Ref, ...
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/factrey/ref/shorthand_methods.rb', line 17 def ref(name = nil, &) if name raise ArgumentError, "both name and block given" if block_given? Ref.new(name) elsif block_given? Defer.new(&) else Builder.new end end |