Class: Starter::Importer::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/starter/importer/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(naming:, paths:, components:) ⇒ Namespace

Returns a new instance of Namespace.



9
10
11
12
13
# File 'lib/starter/importer/namespace.rb', line 9

def initialize(naming:, paths:, components:)
  @naming = naming
  @paths = paths
  @components = components
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



7
8
9
# File 'lib/starter/importer/namespace.rb', line 7

def components
  @components
end

#namingObject

Returns the value of attribute naming.



7
8
9
# File 'lib/starter/importer/namespace.rb', line 7

def naming
  @naming
end

#pathsObject

Returns the value of attribute paths.



7
8
9
# File 'lib/starter/importer/namespace.rb', line 7

def paths
  @paths
end

Instance Method Details

#contentObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/starter/importer/namespace.rb', line 15

def content
  <<-FILE.strip_heredoc
  # frozen_string_literal: true

  module Api
    module Endpoints
      class #{@naming.klass_name} < Grape::API
        namespace #{namespace} do
          #{endpoints.join("\n")}
        end
      end
    end
  end
  FILE
end