Class: FormStalker::Data::CheckLogic

Inherits:
Base
  • Object
show all
Defined in:
lib/form_stalker/data/check_logic.rb

Instance Attribute Summary

Attributes inherited from Base

#parser

Instance Method Summary collapse

Methods inherited from Base

#attributes_before_type_cast, inherited, schema, tap_into, type_cast_schema

Constructor Details

#initialize(attributes) ⇒ CheckLogic

Returns a new instance of CheckLogic.



8
9
10
11
12
13
14
# File 'lib/form_stalker/data/check_logic.rb', line 8

def initialize(attributes)
  if attributes.is_a? String
    attributes = Helpers.json_to_hash "{#{js_to_json(attributes)}}"
  end

  super attributes
end

Instance Method Details

#parse_checks(checks) ⇒ Object



20
21
22
# File 'lib/form_stalker/data/check_logic.rb', line 20

def parse_checks(checks)
  checks.map { |check| CheckLogic.new(check).attributes }
end

#parse_fields(fields) ⇒ Object



16
17
18
# File 'lib/form_stalker/data/check_logic.rb', line 16

def parse_fields(fields)
  fields.map(&:to_i)
end