Sha256: e1cbf069575e89f17c88dc732e0e7b8354ba542be72f30163c5f1454020bae51
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
module Ooz module Model class Ooze < Base::Ooze overridable_const :evolution_class, Model::Evolution overridable_const :section_class, Model::Section overridable_const :field_factory_class, Model::FieldFactory overridable_const :force_class, Model::Force def tagged?(tag, search_on: :tags) haystack = self.send(search_on) haystack.include?(tag) end def stages? evolution && evolution.stages&.length > 0 end def stages return [] if !stages? evolution.stages end def stages_hash to_hash(stages) end def stages_by_section stages.map do |stg| stg.flow_node_ids.map do |id| [id, stg] end end.flatten(1).group_by do |pair| pair.first end.transform_values do |arr_pairs| arr_pairs.map {|pair| pair.last} end end def fields membranes end def fields_hash(key: "_id") to_hash(fields, key: key) end def sections flow_nodes end def sections_hash to_hash(sections) end def sections_by_field sections.map do |sec| sec.field_ids.map do |id| [id, sec] end end.flatten(1).to_h end def bindings forces.reduce([]) do |binds, f| binds + f.bindings end end def bindings_by_field bindings.group_by do |b| b.reference_id end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooze-parser-0.1.8 | lib/ooz/model/ooze.rb |