Module: VkillGemsMethods::Rails::Generators::Base::InstanceMethods
- Defined in:
- lib/vkill_gems_methods/rails/generators/base.rb
Instance Method Summary collapse
-
#say_custom(type = 'warn', text) ⇒ Object
example, type choise in FATAL,ERROR,WARN,INFO,DEBUG.
- #say_debug(text) ⇒ Object
- #say_error(text) ⇒ Object
- #say_fatal(text) ⇒ Object
- #say_info(text) ⇒ Object
- #say_warn(text) ⇒ Object
Instance Method Details
#say_custom(type = 'warn', text) ⇒ Object
example, type choise in FATAL,ERROR,WARN,INFO,DEBUG
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 12 def say_custom(type='warn', text) #example, type choise in FATAL,ERROR,WARN,INFO,DEBUG ansicolor = #more ansicolor => https://github.com/flori/term-ansicolor case type.downcase.to_s when 'fatal'; '31m' when 'error'; '31m' when 'warn'; '36m' when 'info'; '32m' when 'debug'; '34m' else; '0m' end say "\033[1m\033[#{ ansicolor }" + type.to_s.upcase.rjust(10) + "\033[0m" + " #{text}" end |
#say_debug(text) ⇒ Object
28 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 28 def say_debug(text); say_custom('debug', text); end |
#say_error(text) ⇒ Object
25 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 25 def say_error(text); say_custom('error', text); exit; end |
#say_fatal(text) ⇒ Object
24 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 24 def say_fatal(text); say_custom('fatal', text); exit; end |
#say_info(text) ⇒ Object
27 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 27 def say_info(text); say_custom('info', text); end |
#say_warn(text) ⇒ Object
26 |
# File 'lib/vkill_gems_methods/rails/generators/base.rb', line 26 def say_warn(text); say_custom('warn', text); end |