Sha256: d93d7cced1f2990d5d17ed643fc466121c70f5a1b6e065b0fb959623bd61ea71

Contents?: true

Size: 559 Bytes

Versions: 15

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

class Grumlin::Expressions::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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
grumlin-1.2.0 lib/grumlin/expressions/with_options.rb
grumlin-1.1.0 lib/grumlin/expressions/with_options.rb
grumlin-1.0.4 lib/grumlin/expressions/with_options.rb
grumlin-1.0.3 lib/grumlin/expressions/with_options.rb
grumlin-1.0.3.beta1 lib/grumlin/expressions/with_options.rb
grumlin-1.0.2 lib/grumlin/expressions/with_options.rb
grumlin-1.0.1 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc7 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc6 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc5 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc4 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc3 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc2 lib/grumlin/expressions/with_options.rb
grumlin-1.0.0.rc1 lib/grumlin/expressions/with_options.rb