Class: BBK::App::Domains::ByBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/app/domains/by_block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ ByBlock

Returns a new instance of ByBlock.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/bbk/app/domains/by_block.rb', line 8

def initialize(name, &block)
  raise ArgumentError.new('no block') unless block_given?

  @name = name
  @block = block
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/bbk/app/domains/by_block.rb', line 6

def name
  @name
end

Instance Method Details

#call(route) ⇒ Object



15
16
17
# File 'lib/bbk/app/domains/by_block.rb', line 15

def call(route)
  @block.call(route)
end