darthjee/sinclair

View on GitHub
lib/sinclair/method_builder/block_method_builder.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

class Sinclair
  class MethodBuilder
    # @api private
    # @author darthjee
    #
    # Class responsible to build methods from
    # block definitions
    #
    # @see MethodDefinition::BlockDefinition
    class BlockMethodBuilder < Base
      # Builds the method
      #
      # @return (see Base#build)
      def build
        evaluating_class.define_method(name, method_block)
      end

      delegate :name, :method_block, to: :definition
    end
  end
end