Sha256: cbce9681e71bd2be40f4893d6f2480f85a21373238e26ef7ca3d25631d2d2825
Contents?: true
Size: 871 Bytes
Versions: 3
Compression:
Stored size: 871 Bytes
Contents
unless { a: 1 }.respond_to?(:fetch_values) # Add fetch_values if this version of ruby does not define it. class Hash def fetch_values(*keys) result = [] keys.each do |k| result << if block_given? yield(self[k]) else self[k] end end result end end end unless ''.respond_to?(:match?) # Add String#match? to pre-2.4 ruby class String def match?(regexp) self =~ regexp end end end unless //.respond_to?(:match?) # Add Regexp#match? to pre-2.4 ruby class Regexp def match?(str) self =~ str end end end unless ''.respond_to?(:strip_heredoc) # Patch String to provide heredocs with whitespace stripped class String def strip_heredoc indent = chomp.scan(/^\s*/).min.size gsub(/^\s{#{indent}}/, '') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fat_table-0.3.0 | lib/fat_table/patches.rb |
fat_table-0.2.11 | lib/fat_table/patches.rb |
fat_table-0.2.9 | lib/fat_table/patches.rb |