Sha256: 158d594c1783d41bf5d058360811cfc5694d1b707d7d588d69ba42ead31bab51

Contents?: true

Size: 938 Bytes

Versions: 61

Compression:

Stored size: 938 Bytes

Contents

class Object
  
  # Puts a text in the form:
  #   12:34:56: text here
  #
  def timed_exclaim text
    exclaim "#{Time.now.strftime("%H:%M:%S")}: #{text}"
  end

  # Just outputs the given text to the logger.
  #
  # Note: stubbed in spec_helper.rb
  #
  def exclaim text
    Picky.logger.info text
    Picky.logger.flush
  end

  # Puts a text that informs the user of a missing gem.
  #
  def warn_gem_missing gem_name, message
    Picky.logger.warn <<-WARNING
Warning: #{gem_name} gem missing!
To use #{message}, 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

  # Indents each line by <tt>amount=2</tt> spaces.
  #
  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

end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
picky-4.31.3 lib/picky/extensions/object.rb
picky-4.31.2 lib/picky/extensions/object.rb
picky-4.31.1 lib/picky/extensions/object.rb
picky-4.31.0 lib/picky/extensions/object.rb
picky-4.30.0 lib/picky/extensions/object.rb
picky-4.29.0 lib/picky/extensions/object.rb
picky-4.28.1 lib/picky/extensions/object.rb
picky-4.27.1 lib/picky/extensions/object.rb
picky-4.27.0 lib/picky/extensions/object.rb
picky-4.26.2 lib/picky/extensions/object.rb
picky-4.26.1 lib/picky/extensions/object.rb
picky-4.26.0 lib/picky/extensions/object.rb
picky-4.25.3 lib/picky/extensions/object.rb
picky-4.25.2 lib/picky/extensions/object.rb
picky-4.25.1 lib/picky/extensions/object.rb
picky-4.25.0 lib/picky/extensions/object.rb
picky-4.24.0 lib/picky/extensions/object.rb
picky-4.23.2 lib/picky/extensions/object.rb
picky-4.23.1 lib/picky/extensions/object.rb
picky-4.23.0 lib/picky/extensions/object.rb