Class: DocTemplate::Objects::ActivityMetadata
- Inherits:
-
Object
- Object
- DocTemplate::Objects::ActivityMetadata
- Includes:
- TocHelpers
- Defined in:
- lib/doc_template/objects/activity_metadata.rb
Defined Under Namespace
Classes: Activity
Class Method Summary collapse
Methods included from TocHelpers
#find_by_anchor, #level1_by_title, #level2_by_title
Class Method Details
.build_from(data) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/doc_template/objects/activity_metadata.rb', line 49 def self.build_from(data) copy = Marshal.load Marshal.dump(data) activity_data = copy.map do |d| d.transform_keys! { |k| k.to_s.underscore } d['activity_time'] = d['activity_time'].to_s[/\d+/].to_i d['optional'] = d['optional']&.casecmp('optional')&.zero? d end new(set_index(children: activity_data)) end |