Method: LL::Checklist#parse_document!

Defined in:
lib/ll/checklist.rb

#parse_document!(document) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ll/checklist.rb', line 57

def parse_document! document
  if document.is_a? String
    document = document.parse_json
  elsif document.is_a? Hash
  else
    fail TypeError, "Checklist expects string or hash document"
  end

  document.symbolize_keys!

  attrs = %i[ meta
              title
              description
              identifier
              serialization_identifier
              action_at
              steps ]

  self.set_attrs_via attrs, document: document
end