Sha256: 19dae4f2adabf5bc5bc5d159ab72e8af830caca51bd0e8bc6c6c62cfe4f37487

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

module Factrey
  class DSL
    # An intermediate object for <code>let(:name).node(...)</code> notation. See {DSL#let}.
    class Let < BasicObject
      attr_reader :name

      # @param dsl [DSL]
      # @param name [Symbol, nil]
      def initialize(dsl, name)
        @dsl = dsl
        @name = name
      end

      # @!visibility private
      def respond_to_missing?(_method_name, _) = true

      def method_missing(method_name, ...) = @dsl.let(@name) { @dsl.__send__(method_name, ...) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
factrey-0.3.0 lib/factrey/dsl/let.rb
factrey-0.2.0 lib/factrey/dsl/let.rb
factrey-0.1.0 lib/factrey/dsl/let.rb