Sha256: 67cb4dd1e687cafd780c481b7895a77a7dbc7ac02eef33c70af13131f2959587

Contents?: true

Size: 740 Bytes

Versions: 42

Compression:

Stored size: 740 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
    puts text
  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  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

42 entries across 42 versions & 1 rubygems

Version Path
picky-3.1.13 lib/picky/extensions/object.rb
picky-3.1.12 lib/picky/extensions/object.rb
picky-3.1.11 lib/picky/extensions/object.rb
picky-3.1.10 lib/picky/extensions/object.rb
picky-3.1.9 lib/picky/extensions/object.rb
picky-3.1.8 lib/picky/extensions/object.rb
picky-3.1.7 lib/picky/extensions/object.rb
picky-3.1.6 lib/picky/extensions/object.rb
picky-3.1.5 lib/picky/extensions/object.rb
picky-3.1.4 lib/picky/extensions/object.rb
picky-3.1.3 lib/picky/extensions/object.rb
picky-3.1.2 lib/picky/extensions/object.rb
picky-3.1.1 lib/picky/extensions/object.rb
picky-3.1.0 lib/picky/extensions/object.rb
picky-3.0.1 lib/picky/extensions/object.rb
picky-3.0.0 lib/picky/extensions/object.rb
picky-3.0.0.pre5 lib/picky/extensions/object.rb
picky-3.0.0.pre4 lib/picky/extensions/object.rb
picky-3.0.0.pre3 lib/picky/extensions/object.rb
picky-3.0.0.pre2 lib/picky/extensions/object.rb