Sha256: ba375e50b26bd7276f578589844bf7588605f2a2e35da4bf4f637a097ff6c3ba
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require "expressir/express/model_element" module Expressir module Express class GlobalRule < ModelElement attr_accessor :name, :entities, :algorithm, :wheres, :schema, :entities_array def initialize(options = {}) @entities_array = [] @wheres = [] @options = options @schema = options.fetch(:schema, nil) end def parse document = @options.fetch(:document) extract_rule_attributes(document) self end def self.parse(document, schema) new(document: document, schema: schema).parse end private def extract_rule_attributes(document) @wheres = extract_where_rules(document) @name = document.attributes["name"].to_s @entities = document.attributes["appliesto"].to_s @algorithm = document.attributes["algorithm"] end def extract_where_rules(document) document.xpath("where").map do |where| Express::WhereRule.parse(where) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
expressir-0.2.6 | lib/expressir/express/global_rule.rb |
expressir-0.2.5-x64-mingw32 | lib/expressir/express/global_rule.rb |
expressir-0.2.4-x64-mingw32 | lib/expressir/express/global_rule.rb |