Class: Savon::LogMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/log_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, filter, options = {}) ⇒ LogMessage

Returns a new instance of LogMessage.



4
5
6
7
8
9
# File 'lib/savon/log_message.rb', line 4

def initialize(message, filter, options = {})
  self.message     = message
  self.filter      = filter
  self.with_pretty = options[:pretty]
  self.with_filter = options[:filter]
end

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



11
12
13
# File 'lib/savon/log_message.rb', line 11

def filter
  @filter
end

#messageObject

Returns the value of attribute message.



11
12
13
# File 'lib/savon/log_message.rb', line 11

def message
  @message
end

#with_filterObject

Returns the value of attribute with_filter.



11
12
13
# File 'lib/savon/log_message.rb', line 11

def with_filter
  @with_filter
end

#with_prettyObject

Returns the value of attribute with_pretty.



11
12
13
# File 'lib/savon/log_message.rb', line 11

def with_pretty
  @with_pretty
end

Instance Method Details

#filter?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/savon/log_message.rb', line 13

def filter?
  with_filter && filter.any?
end

#pretty?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/savon/log_message.rb', line 17

def pretty?
  with_pretty
end

#to_sObject



21
22
23
24
25
26
27
# File 'lib/savon/log_message.rb', line 21

def to_s
  return message unless pretty? || filter?

  doc = Nokogiri::XML(message)
  doc = apply_filter(doc) if filter?
  doc.to_xml(pretty_options)
end