lib/timber/contexts/custom.rb in timber-2.1.9 vs lib/timber/contexts/custom.rb in timber-2.1.10
- old
+ new
@@ -22,16 +22,16 @@
@keyspace = :custom
attr_reader :type, :data
def initialize(attributes)
- @type = attributes[:type] || raise(ArgumentError.new(":type is required"))
+ @type = Timber::Util::Object.try(attributes[:type], :to_sym) || raise(ArgumentError.new(":type is required"))
@data = attributes[:data] || raise(ArgumentError.new(":data is required"))
end
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
def as_json(options = {})
- {Timber::Util::Object.try(type, :to_sym) => data}
+ {type => data}
end
end
end
end
\ No newline at end of file