Class: RKit::Override::Pattern

Inherits:
Object
  • Object
show all
Defined in:
lib/r_kit/override/pattern.rb

Constant Summary collapse

STANDARD_PATTERN =
-> *_ do
  ->(*args, &block){ __newdef__(*args, &block) }
end
DEPEND_PATTERN =
-> on: do
  -> *args, &block do
    if send(on).present?
      __newdef__(*args, &block)
    else
      nil
    end
  end
end
IF_PATTERN =
-> on: do
  -> *args, &block do
    if send(on).present?
      __newdef__(*args, &block)
    else
      __olddef__(*args, &block)
    end
  end
end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, *args) ⇒ Pattern



10
11
12
13
# File 'lib/r_kit/override/pattern.rb', line 10

def initialize pattern, *args
  @pattern = pattern
  @args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/r_kit/override/pattern.rb', line 8

def args
  @args
end

#patternObject

Returns the value of attribute pattern.



8
9
10
# File 'lib/r_kit/override/pattern.rb', line 8

def pattern
  @pattern
end

Class Method Details

.build(*args) ⇒ Object



3
4
5
# File 'lib/r_kit/override/pattern.rb', line 3

def self.build *args
  new(*args).build
end

Instance Method Details

#buildObject



15
16
17
# File 'lib/r_kit/override/pattern.rb', line 15

def build
  send "build_from_#{ pattern.class.name.underscore }"
end