Sha256: 0ed726fc2610ccefb0b862afe918fc00cede17136742a73b3ef60c51fe5b078b

Contents?: true

Size: 734 Bytes

Versions: 16

Compression:

Stored size: 734 Bytes

Contents

# 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
        klass.send(method_definition, name, method_block)
      end

      private

      delegate :name, :method_block, to: :definition

      # @private
      #
      # name of the method used to define a new method on class
      #
      # @return [Symbol]
      def method_definition
        instance? ? :define_method : :define_singleton_method
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sinclair-1.11.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.10.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.9.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.8.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.7.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.7 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.6 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.5 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.4 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.3 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.2 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.1 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.6.0 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.5.2 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.5.1 lib/sinclair/method_builder/block_method_builder.rb
sinclair-1.5.0 lib/sinclair/method_builder/block_method_builder.rb