Class: ServiceObjects::Parsers::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/service_objects/parsers/dependency.rb

Overview

Parses and decorates a string, describing a notification

Examples:

result = ServiceObjects::Parsers::Dependency.new "add_item{get_item}"
result.name     # => add_item
result.type     # => GetItem
result.listener # => AddItemListener

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.initialize(source) ⇒ Hexx::Services::Parsers::Dependency

Constructs the object from source

Parameters:

  • source (#to_s)

Returns:

  • (Hexx::Services::Parsers::Dependency)


24
25
26
# File 'lib/service_objects/parsers/dependency.rb', line 24

def initialize(source)
  @source = source.to_s
end

Instance Method Details

#listenerString

The listener name for the dependency

Returns:

  • (String)


45
46
47
# File 'lib/service_objects/parsers/dependency.rb', line 45

def listener
  @listener ||= "#{ injector.const }Listener"
end

#nameString

The name for the dependency default implementation

Returns:

  • (String)


31
32
33
# File 'lib/service_objects/parsers/dependency.rb', line 31

def name
  @name ||= injector.item
end

#new(source) ⇒ Hexx::Services::Parsers::Dependency

Constructs the object from source

Parameters:

  • source (#to_s)

Returns:

  • (Hexx::Services::Parsers::Dependency)


24
25
26
# File 'lib/service_objects/parsers/dependency.rb', line 24

def initialize(source)
  @source = source.to_s
end

#typeString

The type for the dependency default implementation

Returns:

  • (String)


38
39
40
# File 'lib/service_objects/parsers/dependency.rb', line 38

def type
  @type ||= injection.type
end