Class: Tracksperanto::Import::FlameStabilizer::StabilizerParser

Inherits:
FlameChannelParser::Parser
  • Object
show all
Defined in:
lib/import/flame_stabilizer.rb

Overview

We subclass the standard parser for a couple of reasons - we want to only parse the needed channels AND we want to provide progress reports

Constant Summary collapse

USEFUL_CHANNELS =
%w( /shift/x /shift/y /ref/x /ref/y ).map(&Regexp.method(:new))

Instance Method Summary collapse

Instance Method Details

#channel_is_useful?(channel_name) ⇒ Boolean

This method tells the importer whether a channel that has been found in the source setup is needed. If that method returns false the channel will be discarded and not kept in memory. Should you need to write a module that scavenges other Flame animation channels inherit from this class and rewrite this method to either return true always (then all the channels will be recovered) or to return true only for channels that you actually need.

Returns:

  • (Boolean)


63
64
65
# File 'lib/import/flame_stabilizer.rb', line 63

def channel_is_useful?(channel_name)
  USEFUL_CHANNELS.any?{|e| channel_name =~ e }
end