class Antelope::Ace::Scanner::Argument
Represents an argument to a directive. It encapsulates a string object, which is the value of the argument.
Public Class Methods
new(type, value)
click to toggle source
Initialize the argument.
@param type [Symbol] the type of argument it is; it can be
a `:block`, `:text`, or `:caret`. The type is defined by the encapsulating characters. If the encapsulating characters are `{` and `}`, it's a `:block`; if they are `<` and `>`, it's a `:caret`; otherwise, it's a `:text`.
@param value [String] the value of the argument.
Calls superclass method
# File lib/antelope/ace/scanner/argument.rb, line 17 def initialize(type, value) @type = type super(value) end
Public Instance Methods
block?()
click to toggle source
If this argument is type ‘:block`.
@return [Boolean] @see type?
# File lib/antelope/ace/scanner/argument.rb, line 26 def block? type? :block end
caret?()
click to toggle source
If this argument is type ‘:caret`.
@return [Boolean] @see type?
# File lib/antelope/ace/scanner/argument.rb, line 42 def caret? type? :caret end
text?()
click to toggle source
If this argument is type ‘:text`.
@return [Boolean] @see type?
# File lib/antelope/ace/scanner/argument.rb, line 34 def text? type? :text end
type?(*inc)
click to toggle source
Checks to see if any of the given arguments match the type of this argument.
@param inc [Array<Symbol>] @return [Boolean]
# File lib/antelope/ace/scanner/argument.rb, line 51 def type?(*inc) inc.include?(@type) end