Module: Blinkbox::CommonMessaging::JsonSchemaPowered

Extended by:
Forwardable
Defined in:
lib/blinkbox/common_messaging.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



145
146
147
# File 'lib/blinkbox/common_messaging.rb', line 145

def method_missing(m, *args, &block)
  @data.send(m, *args, &block)
end

Instance Method Details

#==(other) ⇒ Object



157
158
159
160
161
162
# File 'lib/blinkbox/common_messaging.rb', line 157

def ==(other)
  self.to_hash == other.to_hash
rescue
  # Any errors would be because the other isn't a hash, so the answer must be false
  false
end

#inspectObject



164
165
166
167
168
169
170
171
# File 'lib/blinkbox/common_messaging.rb', line 164

def inspect
  classification_string = @data["classification"].map do |cl| 
    "#{cl["realm"]}:#{cl["id"]}"
  end.join(", ")
  "<#{self.class.name.split("::").last}: #{classification_string}>"
rescue
  to_s
end

#to_hashObject



149
150
151
# File 'lib/blinkbox/common_messaging.rb', line 149

def to_hash
  @data
end

#to_sObject



153
154
155
# File 'lib/blinkbox/common_messaging.rb', line 153

def to_s
  @data.to_json
end