Sha256: 04961645eedaba7fdc1756d88ef1d0edd59f481a9c2e2b69607783ff12ec81cf

Contents?: true

Size: 385 Bytes

Versions: 4

Compression:

Stored size: 385 Bytes

Contents

require_relative 'build_method_base'

module Verbalize
  class BuildInitializeMethod < BuildMethodBase
    private

    def declaration
      "def initialize(#{declaration_keyword_arguments})"
    end

    def body
      return if all_keywords.empty?

      lines = all_keywords.map do |keyword|
        "  @#{keyword} = #{keyword}"
      end

      lines.join("\n")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
verbalize-1.4.1 lib/verbalize/build_initialize_method.rb
verbalize-1.3.0 lib/verbalize/build_initialize_method.rb
verbalize-1.2.0 lib/verbalize/build_initialize_method.rb
verbalize-1.1.1 lib/verbalize/build_initialize_method.rb