lib/grumlin/expressions/with_options.rb in grumlin-0.23.0 vs lib/grumlin/expressions/with_options.rb in grumlin-1.0.0.rc1
- old
+ new
@@ -1,31 +1,27 @@
# frozen_string_literal: true
-module Grumlin
- module Expressions
- class WithOptions
- WITH_OPTIONS = Grumlin.definitions.dig(:expressions, :with_options).freeze
+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)
+ 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
+ instance_variable_set(name, WithOptions.new(k, v))
end
+ end
+ end
- attr_reader :name, :value
+ attr_reader :name, :value
- def initialize(name, value)
- @name = name
- @value = value
- end
+ def initialize(name, value)
+ @name = name
+ @value = value
+ end
- def to_s
- "WithOptions.#{@name}"
- end
- end
+ def to_s
+ "WithOptions.#{@name}"
end
end