Class: ShortBus::Spec

Inherits:
Object
  • Object
show all
Defined in:
lib/short_bus/spec.rb

Overview

Used for message_specs and publisher_specs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec = nil) ⇒ Spec

Returns a new instance of Spec.



10
11
12
# File 'lib/short_bus/spec.rb', line 10

def initialize(spec = nil)
  @specs = process(spec)
end

Instance Attribute Details

#specsObject (readonly)

Returns the value of attribute specs.



8
9
10
# File 'lib/short_bus/spec.rb', line 8

def specs
  @specs
end

Instance Method Details

#<<(spec) ⇒ Object



14
15
16
# File 'lib/short_bus/spec.rb', line 14

def <<(spec)
  @specs += process(spec)
end

#delete(spec) ⇒ Object



18
19
20
# File 'lib/short_bus/spec.rb', line 18

def delete(spec)
  @specs.delete spec
end

#match(item) ⇒ Object



22
23
24
# File 'lib/short_bus/spec.rb', line 22

def match(item)
  @specs.reduce(false) { |a, e| a || match_single(e, item) }
end