class PSD::EngineData::Instruction
A single instruction as defined by the EngineData
spec.
Public Class Methods
match(text)
click to toggle source
Checks to see if the given text is a match for this token.
# File lib/psd/enginedata/instruction.rb, line 9 def self.match(text) begin token.match(text) rescue Encoding::CompatibilityError nil end end
new(document, text)
click to toggle source
Stores a reference to the EngineData
document and the current String
being parsed.
# File lib/psd/enginedata/instruction.rb, line 19 def initialize(document, text) @document = document @text = text end
token()
click to toggle source
The regex for the token, defaulted to nil. Override this.
# File lib/psd/enginedata/instruction.rb, line 6 def self.token; end
Public Instance Methods
execute!()
click to toggle source
Once matched, we execute the instruction and apply the changes to the parsed data.
# File lib/psd/enginedata/instruction.rb, line 31 def execute!; end
match()
click to toggle source
Returns the regex match to the current string.
# File lib/psd/enginedata/instruction.rb, line 25 def match self.class.match @text end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/psd/enginedata/instruction.rb, line 33 def method_missing(method, *args, &block) if @document.respond_to?(method) return @document.send(method, *args) end super end