Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_ext/string.rb

Overview

extending String with #parameterized? and #balanced_parens? only to assist macro.rb

Instance Method Summary collapse

Instance Method Details

#balanced_parens?Boolean

returns whether number of open parentheses and close parentheses match

Returns:

  • (Boolean)


9
10
11
# File 'lib/ruby_ext/string.rb', line 9

def balanced_parens?
  self.match('(').size == self.match(')').size
end

#parameterized?Boolean

returns whether or not contents include any Macro strings i.e. Parameter expressions

Returns:

  • (Boolean)


4
5
6
# File 'lib/ruby_ext/string.rb', line 4

def parameterized?
  self.include?('@(')
end