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