Class: Makit::Cli::Generators::Templates::Ruby::MainLib

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/cli/generators/templates/ruby/main_lib.rb

Overview

Template for main Ruby gem lib file

Instance Method Summary collapse

Constructor Details

#initialize(project_name) ⇒ MainLib

Returns a new instance of MainLib.



10
11
12
13
# File 'lib/makit/cli/generators/templates/ruby/main_lib.rb', line 10

def initialize(project_name)
  @project_name = project_name
  @module_name = project_name.split(/[-_]/).map(&:capitalize).join
end

Instance Method Details

#renderObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/makit/cli/generators/templates/ruby/main_lib.rb', line 15

def render
  "    # frozen_string_literal: true\n\n    require_relative \"\#{@project_name}/version\"\n\n    module \#{@module_name}\n      class Error < StandardError; end\n    \#{\"  \"}\n      # Your code goes here...\n    end\n  RUBY\nend\n"