Sha256: f605461790e8e2ac5796641191ae067536e3620895115be458620da281cf908c

Contents?: true

Size: 602 Bytes

Versions: 6

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

require 'sinclair'

module Azeroth
  class Decorator
    # Responsible for building readers for attributes
    # @api private
    class MethodBuilder < Sinclair
      # Builds reader
      #
      # reaader delegate method calls to @object
      #
      # @return [Array<Sinclair::MethodDefinition>]
      def self.build_reader(klass, attribute)
        new(klass).build_reader(attribute)
      end

      # (see MethodBuilder.build_reader)
      def build_reader(attribute)
        add_method(attribute, "@object.#{attribute}")
        build
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
azeroth-1.0.0 lib/azeroth/decorator/method_builder.rb
azeroth-0.10.1 lib/azeroth/decorator/method_builder.rb
azeroth-0.10.0 lib/azeroth/decorator/method_builder.rb
azeroth-0.9.0 lib/azeroth/decorator/method_builder.rb
azeroth-0.8.2 lib/azeroth/decorator/method_builder.rb
azeroth-0.8.1 lib/azeroth/decorator/method_builder.rb