Module: RubyFeatures::Mixins

Defined in:
lib/ruby-features/mixins.rb

Class Method Summary collapse

Class Method Details

.new(feature_name, feature_body) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ruby-features/mixins.rb', line 5

def new(feature_name, feature_body)
  RubyFeatures::Utils.prepare_module!(
    self,
    RubyFeatures::Utils.camelize(feature_name)
  ).tap do |feature_module|
    feature_module.extend RubyFeatures::Concern::Feature
    feature_module._set_feature_name(feature_name)
    feature_module.class_eval(&feature_body) if feature_body
  end
end