Class: PM::Filter
- Inherits:
-
Object
- Object
- PM::Filter
- Defined in:
- lib/patchmaster/filter.rb
Overview
Filters are blocks of code executed by a Connection to modify incoming MIDI bytes. Since we want to save them to files, we store the text representation as well.
Instance Attribute Summary collapse
-
#code_chunk ⇒ Object
Returns the value of attribute code_chunk.
Instance Method Summary collapse
- #call(conn, bytes) ⇒ Object
-
#initialize(code_chunk) ⇒ Filter
constructor
A new instance of Filter.
- #to_s ⇒ Object
Constructor Details
#initialize(code_chunk) ⇒ Filter
Returns a new instance of Filter.
10 11 12 |
# File 'lib/patchmaster/filter.rb', line 10 def initialize(code_chunk) @code_chunk = code_chunk end |
Instance Attribute Details
#code_chunk ⇒ Object
Returns the value of attribute code_chunk.
8 9 10 |
# File 'lib/patchmaster/filter.rb', line 8 def code_chunk @code_chunk end |
Instance Method Details
#call(conn, bytes) ⇒ Object
14 15 16 |
# File 'lib/patchmaster/filter.rb', line 14 def call(conn, bytes) @code_chunk.run(conn, bytes) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/patchmaster/filter.rb', line 18 def to_s @code_chunk.text || '# no block text found' end |