Sha256: 0513512ddf3fb8068584bd142ee080c294100d35e13a108978d868aea946afe1

Contents?: true

Size: 662 Bytes

Versions: 135

Compression:

Stored size: 662 Bytes

Contents

require "expressir/express/model_element"

module Expressir
  module Express
    class WhereRule < ModelElement
      attr_accessor :name, :expression

      def initialize(options = {})
        @name = nil
        @options = options
      end

      def parse
        document = @options.fetch(:where, nil)
        extract_where_attributes(document) if document

        self
      end

      def self.parse(document)
        new(document: document).parse
      end

      private

      def extract_where_attributes(document)
        @name = document.attributes["label"].to_s
        @expression = document.attributes["expression"]
      end
    end
  end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
expressir-0.2.27 lib/expressir/express/where_rule.rb
expressir-0.2.27-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.27-x86_64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.27-x86-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.27-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.27-x64-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.27-arm64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.26 lib/expressir/express/where_rule.rb
expressir-0.2.26-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.26-x86_64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.26-x86-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.26-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.26-x64-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.26-arm64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.25 lib/expressir/express/where_rule.rb
expressir-0.2.25-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.25-x86_64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.25-x86-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.25-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.25-x64-mingw32 lib/expressir/express/where_rule.rb