Sha256: ae5a5ea5bc0073e0fbfbfa6368cabb20620fe640406dda24124b6ececcbb1bec

Contents?: true

Size: 663 Bytes

Versions: 25

Compression:

Stored size: 663 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  module Expressions
    class WithOptions
      WITH_OPTIONS = Grumlin.definitions.dig(:expressions, :with_options).freeze

      class << self
        WITH_OPTIONS.each do |k, v|
          define_method k do
            name = "@#{k}"
            return instance_variable_get(name) if instance_variable_defined?(name)

            instance_variable_set(name, WithOptions.new(k, v))
          end
        end
      end

      attr_reader :name, :value

      def initialize(name, value)
        @name = name
        @value = value
      end

      def to_s
        "WithOptions.#{@name}"
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
grumlin-0.23.0 lib/grumlin/expressions/with_options.rb
grumlin-0.22.5 lib/grumlin/expressions/with_options.rb
grumlin-0.22.4 lib/grumlin/expressions/with_options.rb
grumlin-0.22.3 lib/grumlin/expressions/with_options.rb
grumlin-0.22.2 lib/grumlin/expressions/with_options.rb
grumlin-0.22.1 lib/grumlin/expressions/with_options.rb
grumlin-0.22.0 lib/grumlin/expressions/with_options.rb
grumlin-0.21.1 lib/grumlin/expressions/with_options.rb
grumlin-0.21.0 lib/grumlin/expressions/with_options.rb
grumlin-0.20.2 lib/grumlin/expressions/with_options.rb
grumlin-0.20.1 lib/grumlin/expressions/with_options.rb
grumlin-0.20.0 lib/grumlin/expressions/with_options.rb
grumlin-0.19.7 lib/grumlin/expressions/with_options.rb
grumlin-0.19.6 lib/grumlin/expressions/with_options.rb
grumlin-0.19.5 lib/grumlin/expressions/with_options.rb
grumlin-0.19.4 lib/grumlin/expressions/with_options.rb
grumlin-0.19.3 lib/grumlin/expressions/with_options.rb
grumlin-0.19.2 lib/grumlin/expressions/with_options.rb
grumlin-0.19.1 lib/grumlin/expressions/with_options.rb
grumlin-0.19.0 lib/grumlin/expressions/with_options.rb