Sha256: c9abe0c1ee9fa9bd5019e153aa982b810197f5fd9fc41713aae89a910c845557

Contents?: true

Size: 851 Bytes

Versions: 14

Compression:

Stored size: 851 Bytes

Contents

class Object # :nodoc:all

  # 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 puts the given text.
  #
  def exclaim text
    STDOUT.puts text
    STDOUT.flush
  end

  # Puts a text that informs the user of a missing gem.
  #
  def warn_gem_missing gem_name, message
    warn "#{gem_name} gem missing!\nTo use #{message}, you need to:\n  1. Add the following line to Gemfile:\n     gem '#{gem_name}'\n     or\n     require '#{gem_name}'\n     for example at the top of your app.rb file.\n  2. Then, run:\n     bundle update\n"
  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

14 entries across 14 versions & 1 rubygems

Version Path
picky-4.1.0 lib/picky/extensions/object.rb
picky-4.0.9 lib/picky/extensions/object.rb
picky-4.0.8 lib/picky/extensions/object.rb
picky-4.0.7 lib/picky/extensions/object.rb
picky-4.0.6 lib/picky/extensions/object.rb
picky-4.0.5 lib/picky/extensions/object.rb
picky-4.0.4 lib/picky/extensions/object.rb
picky-4.0.3 lib/picky/extensions/object.rb
picky-4.0.1 lib/picky/extensions/object.rb
picky-4.0.0 lib/picky/extensions/object.rb
picky-4.0.0pre6 lib/picky/extensions/object.rb
picky-4.0.0pre5 lib/picky/extensions/object.rb
picky-4.0.0pre3 lib/picky/extensions/object.rb
picky-4.0.0pre2 lib/picky/extensions/object.rb