Sha256: 18eebb115d517650f228259db318e282b33e5881081dcaf2b2c79cc9806a457d

Contents?: true

Size: 267 Bytes

Versions: 2

Compression:

Stored size: 267 Bytes

Contents

class String
  
  # match as ((3+5)*6)/2) (3*8)+(1-1)   => true  
  def expression?
    !(self =~ /(?<expression>\((?<left>(\g<expression>|\d*))(?<operate>[\+\-\*\/])(?<right>(\g<expression>|\d*))\))/).nil?
  end

  def is_num?
  	!(self =~ /^\d*$/).nil?
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
24point-0.0.2 lib/24point/string.rb
24point-0.0.1 lib/24point/string.rb