Class: Gurke::Configuration::Hook Private

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/configuration.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, &block) ⇒ Hook

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Hook.



171
172
173
174
# File 'lib/gurke/configuration.rb', line 171

def initialize(opts, &block)
  @opts  = opts
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



169
170
171
# File 'lib/gurke/configuration.rb', line 169

def block
  @block
end

#optsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



169
170
171
# File 'lib/gurke/configuration.rb', line 169

def opts
  @opts
end

Instance Method Details

#match?(context) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


176
177
178
# File 'lib/gurke/configuration.rb', line 176

def match?(context)
  opts.none? {|k, v| context.[k] != v }
end

#run(world, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



180
181
182
183
184
185
186
187
# File 'lib/gurke/configuration.rb', line 180

def run(world, *args)
  block = @block
  if world
    world.instance_exec(*args, &block)
  else
    block.call(*args)
  end
end