Class: Hanami::CLI::Generators::App::SliceContext Private

Inherits:
Context
  • Object
show all
Defined in:
lib/hanami/cli/generators/app/slice_context.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:

  • 2.0.0

Instance Method Summary collapse

Methods inherited from Context

#bundled_assets?, #bundled_dry_monads?, #bundled_views?, #camelized_app_name, #ctx, #database_url, #generate_assets?, #generate_mysql?, #generate_postgres?, #generate_sqlite?, #hanami_assets_npm_package, #hanami_gem, #hanami_gem_version, #hanami_head?, #humanized_app_name, #ruby_omit_hash_values?, #underscored_app_name

Constructor Details

#initialize(inflector, app, slice, url, **options) ⇒ SliceContext

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 SliceContext.

Since:

  • 2.0.0



15
16
17
18
19
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 15

def initialize(inflector, app, slice, url, **options)
  @slice = slice
  @url = url
  super(inflector, app, **options)
end

Instance Method Details

#camelized_slice_nameObject

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:

  • 2.0.0



23
24
25
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 23

def camelized_slice_name
  inflector.camelize(slice)
end

#generate_db?Boolean

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:

  • (Boolean)

Since:

  • 2.2.0



53
54
55
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 53

def generate_db?
  !options.fetch(:skip_db, false)
end

#generate_route?Boolean

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:

  • (Boolean)

Since:

  • 2.2.0



59
60
61
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 59

def generate_route?
  !options.fetch(:skip_route, false)
end

#humanized_slice_nameObject

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:

  • 2.1.0



35
36
37
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 35

def humanized_slice_name
  inflector.humanize(slice)
end

#javascript_erb_tagObject

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:

  • 2.1.0



47
48
49
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 47

def javascript_erb_tag
  %(<%= javascript_tag "app" %>)
end

#stylesheet_erb_tagObject

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:

  • 2.1.0



41
42
43
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 41

def stylesheet_erb_tag
  %(<%= stylesheet_tag "app" %>)
end

#underscored_slice_nameObject

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:

  • 2.0.0



29
30
31
# File 'lib/hanami/cli/generators/app/slice_context.rb', line 29

def underscored_slice_name
  inflector.underscore(slice)
end