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.16-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.16-x64-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.16-arm64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.15 lib/expressir/express/where_rule.rb
expressir-0.2.15-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.15-x86_64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.15-x86-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.15-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.15-x64-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.15-arm64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.14 lib/expressir/express/where_rule.rb
expressir-0.2.14-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.14-x86_64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.14-x86-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.14-x86-linux lib/expressir/express/where_rule.rb
expressir-0.2.14-x64-mingw32 lib/expressir/express/where_rule.rb
expressir-0.2.14-arm64-darwin lib/expressir/express/where_rule.rb
expressir-0.2.13 lib/expressir/express/where_rule.rb
expressir-0.2.13-x86_64-linux lib/expressir/express/where_rule.rb
expressir-0.2.13-x86_64-darwin lib/expressir/express/where_rule.rb