Class: Kybus::CLI::Bot::FileProvider
- Inherits:
-
Object
- Object
- Kybus::CLI::Bot::FileProvider
show all
- Defined in:
- lib/kybus/cli/bot/file_provider.rb
Direct Known Subclasses
BotGenerator, ComposefileGenerator, Config::AutoconfigGenerator, Config::AutoconfigLoaderGenerator, Config::BotBuilderGenerator, Config::ConfigDefaultGenerator, Config::ConfigGenerator, Config::DBGenerator, Config::DeploymentFileProvide, Config::GemfileGenerator, Config::LambdaHandlerGenerator, Config::RakefileGenerator
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, config) ⇒ FileProvider
Returns a new instance of FileProvider.
7
8
9
10
11
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 7
def initialize(name, config)
@file_writer = Kybus::CLI::FileWriter.new(name)
@config = config
@name = name
end
|
Instance Method Details
#bot_name ⇒ Object
32
33
34
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 32
def bot_name
@name
end
|
#bot_name_class ⇒ Object
36
37
38
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 36
def bot_name_class
@name.split('_').map(&:capitalize).join
end
|
#bot_name_constantize ⇒ Object
40
41
42
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 40
def bot_name_constantize
bot_name_snake_case.upcase
end
|
#bot_name_snake_case ⇒ Object
44
45
46
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 44
def bot_name_snake_case
@name.gsub(' ', '_').downcase
end
|
#generate ⇒ Object
21
22
23
24
25
26
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 21
def generate
@file_writer.write(saving_path, make_contents) unless skip_file?
keep_files.each do |file|
@file_writer.write(file, '')
end
end
|
#keep_files ⇒ Object
17
18
19
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 17
def keep_files
[]
end
|
#skip_file? ⇒ Boolean
13
14
15
|
# File 'lib/kybus/cli/bot/file_provider.rb', line 13
def skip_file?
false
end
|