Class: Allure::JSONable
- Inherits:
-
Object
show all
- Defined in:
- lib/allure_ruby_commons/model/jsonable.rb
Overview
General jsonable object implementation
Instance Method Summary
collapse
Instance Method Details
#==(other) ⇒ Object
20
21
22
|
# File 'lib/allure_ruby_commons/model/jsonable.rb', line 20
def ==(other)
self.class == other.class && state == other.state
end
|
#as_json(_options = {}) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/allure_ruby_commons/model/jsonable.rb', line 8
def as_json(_options = {})
instance_variables.each_with_object({}) do |var, map|
key = camelcase(var.to_s.delete_prefix("@"))
value = instance_variable_get(var)
map[key] = value unless value.nil?
end
end
|
#to_json(*options) ⇒ Object
16
17
18
|
# File 'lib/allure_ruby_commons/model/jsonable.rb', line 16
def to_json(*options)
as_json(*options).to_json(*options)
end
|