Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/picky/extensions/object.rb
Instance Method Summary collapse
-
#exclaim(text) ⇒ Object
Just outputs the given text to the logger.
-
#indented_to_s(amount = 2) ⇒ Object
Indents each line by
amount=2spaces. -
#timed_exclaim(text) ⇒ Object
Puts a text in the form: 12:34:56: text here.
-
#warn_gem_missing(gem_name, message) ⇒ Object
Puts a text that informs the user of a missing gem.
Instance Method Details
#exclaim(text) ⇒ Object
Just outputs the given text to the logger.
Note: stubbed in spec_helper.rb
14 15 16 17 |
# File 'lib/picky/extensions/object.rb', line 14 def exclaim text Picky.logger.info text Picky.logger.flush end |
#indented_to_s(amount = 2) ⇒ Object
Indents each line by amount=2 spaces.
37 38 39 40 |
# File 'lib/picky/extensions/object.rb', line 37 def indented_to_s amount = 2 ary = self.respond_to?(:join) ? self : self.to_s.split("\n") ary.map { |s| "#{" "*amount}#{s}"}.join("\n") end |
#timed_exclaim(text) ⇒ Object
Puts a text in the form:
12:34:56: text here
6 7 8 |
# File 'lib/picky/extensions/object.rb', line 6 def timed_exclaim text exclaim "#{Time.now.strftime("%H:%M:%S")}: #{text}" end |
#warn_gem_missing(gem_name, message) ⇒ Object
Puts a text that informs the user of a missing gem.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/picky/extensions/object.rb', line 21 def warn_gem_missing gem_name, Picky.logger.warn <<-WARNING Warning: #{gem_name} gem missing! To use #{}, you need to: 1. Add the following line to Gemfile: gem '#{gem_name}' or require '#{gem_name}' for example at the top of your app.rb file. 2. Then, run: bundle update WARNING end |