class Rubysmith::Builders::Core

Builds project skeleton core structure and minimum file support.

Public Class Methods

call(...) click to toggle source
# File lib/rubysmith/builders/core.rb, line 7
  def self.call(...) = new(...).call

  def initialize configuration, builder: Builder
    @configuration = configuration
    @builder = builder
  end

  def call
    builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
           .render
           .replace(/  (?!(module|end))/, "")

    builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
    nil
  end

  private

  attr_reader :configuration, :builder
end
new(configuration, builder: Builder) click to toggle source
# File lib/rubysmith/builders/core.rb, line 9
def initialize configuration, builder: Builder
  @configuration = configuration
  @builder = builder
end

Public Instance Methods

call() click to toggle source
# File lib/rubysmith/builders/core.rb, line 14
def call
  builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
         .render
         .replace(/  (?!(module|end))/, "")

  builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
  nil
end