Class: Shouter::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/shouter/listener.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, options) ⇒ Listener

Returns a new instance of Listener.



12
13
14
15
16
17
# File 'lib/shouter/listener.rb', line 12

def initialize(object, options)
  raise Shouter::ScopeMissingError unless options[:scope]

  @object = object
  @options = options
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



10
11
12
# File 'lib/shouter/listener.rb', line 10

def object
  @object
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/shouter/listener.rb', line 10

def options
  @options
end

Instance Method Details

#for?(scope) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/shouter/listener.rb', line 19

def for?(scope)
  options[:scope] == scope
end

#single?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/shouter/listener.rb', line 23

def single?
  options[:single] == true
end