Sha256: 7c03f2e67b78472f66f114e960113d639dc934225d85fa4d46f31e638db68ae7
Contents?: true
Size: 648 Bytes
Versions: 4
Compression:
Stored size: 648 Bytes
Contents
# Core Symbol class. class Symbol # Comparison operator based on the one in the String class. def <=>(b) self.to_s <=> b.to_s end end # Core String class. class String # Converts the strings to "title case" (capitalizes each word). def title_case self.snake_case.split('_').map{|s| s.capitalize}.join(' ') end end # Core Hash class. class Hash # Converts the hash to a string of Glyph options. def to_options(sep=" ") "".tap do |s| self.each_pair do |k, v| key = k.to_s s += key.length == 1 ? "-" : "--" s += key s += sep s += v.to_s =~ /\s/ ? "\"#{v}\"" : v.to_s s += " " end end.strip end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
glyph-0.5.3.1 | lib/glyph/system_extensions.rb |
glyph-0.5.2 | lib/glyph/system_extensions.rb |
glyph-0.5.1 | lib/glyph/system_extensions.rb |
glyph-0.5.0 | lib/glyph/system_extensions.rb |