Module: Penetrator::Behavior::ClassMethods

Defined in:
lib/penetrator.rb

Instance Method Summary collapse

Instance Method Details

#behaves_like(trait_name, *args, &block) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/penetrator.rb', line 55

def behaves_like(trait_name, *args, &block)
  full_name = "#{Penetrator::Inflector.camelize(trait_name.to_s)}Trait"
  trait = Penetrator::Inflector.constantize(full_name)
  trait.instance_variable_set(:@_trait_args, args)
  trait.instance_variable_set(:@_trait_block, block)
  include trait
end