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.



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

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

Instance Attribute Details

#regex (readonly)

Returns the value of attribute regex.



23
24
25
# File 'lib/dizby/protocol/refined.rb', line 23

def regex
  @regex
end

Instance Method Details

#call(*args)



25
26
27
# File 'lib/dizby/protocol/refined.rb', line 25

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