class Magellan::Gcs::Proxy::MessageWrapper::Attrs

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/magellan/gcs/proxy/message_wrapper.rb, line 57
def initialize(data)
  @data = data
end

Public Instance Methods

[](key) click to toggle source
# File lib/magellan/gcs/proxy/message_wrapper.rb, line 61
def [](key)
  value = data[key]
  if value.is_a?(String) && value =~ /\A\[.*\]\z|\A\{.*\}\z/
    begin
      JSON.parse(value)
    rescue
      value
    end
  else
    value
  end
end
include?(key) click to toggle source
# File lib/magellan/gcs/proxy/message_wrapper.rb, line 74
def include?(key)
  data.include?(key) || data.include?(key.to_sym)
end