Sha256: 7dfb102f5b47a43ac5f0e3fa78a809f63b3939bd294ac0e2fc6931f1e18ed3de

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

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
    system(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
darkhelmet-darkext-0.0.2 lib/darkext/string.rb