18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/applitools/core/jsonable.rb', line 18
def json_field(*args)
options = Applitools::Utils.(args)
field = args.first.to_sym
options = { method: field }.merge! options
json_methods[field] = options[:method]
return unless options[:method].to_sym == field
attr_accessor field
ruby_style_field = Applitools::Utils.underscore(field.to_s)
return if field.to_s == ruby_style_field
define_method(ruby_style_field) do
send(field)
end
define_method("#{ruby_style_field}=") do |v|
send("#{field}=", v)
end
end
|