Class: Dizby::RefinedProtocol

Inherits:
Object
  • Object
show all
Defined in:
lib/dizby/protocol/refined.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regex, &block) ⇒ RefinedProtocol

Returns a new instance of RefinedProtocol.


14
15
16
17
# File 'lib/dizby/protocol/refined.rb', line 14

def initialize(regex, &block)
  @regex = /^#{format(regex, Dizby::PROTOCOL_REGEX)}$/
  @block = block
end

Instance Attribute Details

#regex (readonly)

Returns the value of attribute regex


19
20
21
# File 'lib/dizby/protocol/refined.rb', line 19

def regex
  @regex
end

Instance Method Details

#call(*args)


21
22
23
# File 'lib/dizby/protocol/refined.rb', line 21

def call(*args)
  @block.call(*args)
end