Module: RubyFeatures::Concern::Feature

Defined in:
lib/ruby-features/concern/feature.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



33
34
35
36
37
38
# File 'lib/ruby-features/concern/feature.rb', line 33

def self.extended(base)
  base.instance_variable_set(:@_dependencies, [])
  base.instance_variable_set(:@_conditions, RubyFeatures::Conditions.new)
  base.instance_variable_set(:@_apply_to_definitions, {})
  base.instance_variable_set(:@_applied, false)
end

Instance Method Details

#_set_name(name) ⇒ Object



23
24
25
# File 'lib/ruby-features/concern/feature.rb', line 23

def _set_name(name)
  @_name = name
end

#applied?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ruby-features/concern/feature.rb', line 19

def applied?
  @_applied
end

#applyObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby-features/concern/feature.rb', line 5

def apply
  unless applied?
    RubyFeatures.apply(*@_dependencies)

    @_apply_to_definitions.keys.each do |target|
      RubyFeatures::Lazy.apply(target) do
        _lazy_apply(target)
      end
    end

    @_applied = true
  end
end

#nameObject



27
28
29
# File 'lib/ruby-features/concern/feature.rb', line 27

def name
  @_name
end