Class: Hanami::CLI::Commands::Templates Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/cli/commands/templates.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0

Constant Summary collapse

NAMESPACE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0

name.sub(Utils::String.demodulize(name), "").freeze

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Templates

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Templates.

Since:

  • 1.1.0



11
12
13
14
15
# File 'lib/hanami/cli/commands/templates.rb', line 11

def initialize(klass)
  word = klass.name.sub(NAMESPACE, "").split("::").map(&:downcase)
  @root = Pathname.new(File.join(__dir__, *word))
  freeze
end

Instance Method Details

#find(*names) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0



19
20
21
# File 'lib/hanami/cli/commands/templates.rb', line 19

def find(*names)
  @root.join(*names)
end