Sha256: 1aac272bf50faa18f22c9b4ca02aa1fac6fd580f9e9f383273bf44d87449cd4c
Contents?: true
Size: 735 Bytes
Versions: 2
Compression:
Stored size: 735 Bytes
Contents
class String ## # Align to +position+, which may be :left, :right, or :center. def align position, length send position, length end alias_method :left, :ljust alias_method :right, :rjust end module Enumerable def map_with_index &block result = [] each_with_index do |v, i| result << yield(v, i) end result end alias :collect_with_index :map_with_index end class Object ## # Yields or instance_eval's a +block+ depending on the arity of a block # in order to support both types of block syntax for DSL's. def yield_or_eval &block if block_given? if block.arity > 0 yield self else self.instance_eval &block end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
visionmedia-terminal-table-1.0.1 | lib/terminal-table/core_ext.rb |
visionmedia-terminal-table-1.0.4 | lib/terminal-table/core_ext.rb |