Class: Hecks::Bluebook::DSL::PortBuilder

Inherits:
Object
  • Object
show all
Includes:
WordGate
Defined in:
lib/hecks/bluebook/dsl/port_builder.rb

Constant Summary collapse

GRAMMAR_CONTEXT =
"Port"

Constants included from WordGate

WordGate::NOT_ADMITTED

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ PortBuilder

Returns a new instance of PortBuilder.



10
11
12
13
# File 'lib/hecks/bluebook/dsl/port_builder.rb', line 10

def initialize(name)
  @name   = name
  @signal = :reply
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hecks::Bluebook::DSL::WordGate

Class Method Details

.build(name, &block) ⇒ Object



22
23
24
25
26
# File 'lib/hecks/bluebook/dsl/port_builder.rb', line 22

def self.build(name, &block)
  builder = new(name)
  builder.instance_eval(&block) if block
  builder.build
end

Instance Method Details

#buildObject



18
19
20
# File 'lib/hecks/bluebook/dsl/port_builder.rb', line 18

def build
  MetaValidator.call_port(Port.new(name: @name, verb: @verb, signal: @signal))
end

#signal(value) ⇒ Object



16
# File 'lib/hecks/bluebook/dsl/port_builder.rb', line 16

def signal(value) = @signal = value.to_sym

#verb(value) ⇒ Object



15
# File 'lib/hecks/bluebook/dsl/port_builder.rb', line 15

def verb(value)   = @verb = value.to_s