Module: Barn::Helpers
- Defined in:
- lib/barn/helpers.rb
Overview
Forwards all ‘define` and `build` calls to a barn configured on the class.
class SomeTest
include Barn::Helpers
self. = MyCustomBarn
end
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/barn/helpers.rb', line 11 def self.included(base) base.class_eval do extend Forwardable def_delegators :"self.class.barn", :define, :build class <<self extend Forwardable def_delegators :"self.barn", :define, :build attr_writer :barn def @barn || ::Barn end end end end |