Module: Applitools::Jsonable
- Included in:
- ImageMatchSettings, ImageMatchSettings::Exact, SessionStartInfo, UniversalCheckSettings, UniversalEyesConfig
- Defined in:
- lib/applitools/core/jsonable.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/applitools/core/jsonable.rb', line 6 def self.included(base) base.extend ClassMethods base.class_eval do class << self attr_accessor :json_methods, :wrap_data_block end @json_methods = {} @wrap_data_block = nil end end |
Instance Method Details
#json ⇒ Object
54 55 56 |
# File 'lib/applitools/core/jsonable.rb', line 54 def json Oj.dump json_data end |
#json_data ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/applitools/core/jsonable.rb', line 44 def json_data result = self.class.json_methods.sort.map do |k,v| val = json_value(send(v)) next if val.nil? [k, val] end.compact.to_h result = self.class.wrap_data_block.call(result) if self.class.wrap_data_block.is_a? Proc result end |