Sha256: 9938c31d76f4f5ea521abbe726b8c1fca82052e817ce6b5558972461de434f8d
Contents?: true
Size: 563 Bytes
Versions: 1
Compression:
Stored size: 563 Bytes
Contents
require 'darkext/hash' class String # Parses a string like "1..10" to a Range def to_range case self.count('.') when 2 elements = self.split('..') return Range.new(elements[0].to_i, elements[1].to_i) when 3 elements = self.split('...') return Range.new(elements[0].to_i, elements[1].to_i-1) end return nil end # Executes the string with system def exec(opts = {}) opts.with_defaults!(:background => false) cmd = self cmd += " &" if opts[:background] system(cmd) end alias :/ :split end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
darkhelmet-darkext-0.0.3 | lib/darkext/string.rb |