Class: Ruckus::Filter

Inherits:
Parsel show all
Defined in:
lib/ruckus/filter.rb

Constant Summary

Constants inherited from Parsel

Parsel::VERBOTEN

Instance Attribute Summary

Attributes inherited from Parsel

#name, #parent, #rendered_offset, #rendering, #tag, #value

Instance Method Summary collapse

Methods inherited from Parsel

bytes_for_bits, coerce, #each_matching_selector, endian?, factory?, #find_containing, #find_tag, #find_tag_struct, #fixup, #in, #incomplete!, #index_for_selectors, #inspect, #matches_selector?, #method_missing, #native?, native?, #next, #out, #parent_structure, #permute, #prev, #resolve, #respond_to?, #root, #size, #visit, #where_am_i?

Constructor Details

#initialize(val, &block) ⇒ Filter

Returns a new instance of Filter.



3
4
5
6
7
8
9
10
# File 'lib/ruckus/filter.rb', line 3

def initialize(val, &block)
    raise "need a block" if not block_given?
    val = val.clone
    val.parent = self
    opts = { :value => val }
    @block = block
    super(opts)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ruckus::Parsel

Instance Method Details

#to_sObject



12
13
14
# File 'lib/ruckus/filter.rb', line 12

def to_s
    @block.call(@value.to_s)
end