Sha256: 934e95465c8f233b345c82c7e517535ee07642f995e96e463bcfaefe8d871682

Contents?: true

Size: 745 Bytes

Versions: 11

Compression:

Stored size: 745 Bytes

Contents

require 'pp'

module CandyCheck
  module CLI
    # A wrapper to output text information to any kind of buffer
    # @example
    #   out = Out.new(std_buffer)
    #   out.print('something') # => appends 'something' to std_buffer
    class Out
      # @return [Object] buffer used as default outlet
      attr_reader :out

      # Bind a new out instance to two buffers
      # @param out [Object] STDOUT is default
      def initialize(out = $stdout)
        @out = out
      end

      # Prints to +out+
      # @param text [String]
      def print(text = '')
        out.puts text
      end

      # Pretty print an object to +out+
      # @param object [Object]
      def pretty(object)
        PP.pp(object, out)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
candy_check-0.5.0 lib/candy_check/cli/out.rb
candy_check-0.4.0 lib/candy_check/cli/out.rb
candy_check-0.3.0 lib/candy_check/cli/out.rb
candy_check-0.2.1 lib/candy_check/cli/out.rb
candy_check-0.2.0 lib/candy_check/cli/out.rb
candy_check-0.1.2 lib/candy_check/cli/out.rb
candy_check-0.1.1 lib/candy_check/cli/out.rb
candy_check-0.1.0.pre lib/candy_check/cli/out.rb
candy_check-0.0.5 lib/candy_check/cli/out.rb
candy_check-0.0.3 lib/candy_check/cli/out.rb
candy_check-0.0.2 lib/candy_check/cli/out.rb