Exception: String::SingleQuoteException

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/ruby/string/arguments.rb

Overview

the exception raised by String#arguments if an odd number of arguments is encountered. you can still extract the other parts of the parsing via its accessors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, index) ⇒ SingleQuoteException

Returns a new instance of SingleQuoteException.



18
19
20
21
# File 'lib/ruby/string/arguments.rb', line 18

def initialize(args, index)
	@index, @pre, @post = index, args[0,index], args[index+1,args.length-index]
	super("A single unescaped quote as argument #{index}")
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



15
16
17
# File 'lib/ruby/string/arguments.rb', line 15

def index
  @index
end

#postObject (readonly)

Returns the value of attribute post.



17
18
19
# File 'lib/ruby/string/arguments.rb', line 17

def post
  @post
end

#preObject (readonly)

Returns the value of attribute pre.



16
17
18
# File 'lib/ruby/string/arguments.rb', line 16

def pre
  @pre
end