Class: Isomorfeus::Puppetmaster::ConsoleMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/isomorfeus/puppetmaster/console_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(message_hash = {}) ⇒ ConsoleMessage

Returns a new instance of ConsoleMessage.



4
5
6
# File 'lib/isomorfeus/puppetmaster/console_message.rb', line 4

def initialize(message_hash = {})
  @message_hash = message_hash ? message_hash : {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/isomorfeus/puppetmaster/console_message.rb', line 8

def method_missing(name, *args)
  if %i[column_number level location line_number text].include?(name)
    @message_hash[name.to_s]
  elsif %i[location url].include?(name)
    @message_hash['location'] ? @message_hash['location']['url'] : ''
  else
    super(name, *args)
  end
end