class SnipSnip::Registry
A list of records that were found during the course of the last request on which we are tracking columns.
Attributes
records[R]
Public Class Methods
instance()
click to toggle source
The singleton instance of this registry.
# File lib/snip_snip/registry.rb, line 31 def instance @instance ||= new end
method_missing(method, *args, &block)
click to toggle source
Delegate all missing methods to the singleton instance.
Calls superclass method
# File lib/snip_snip/registry.rb, line 36 def method_missing(method, *args, &block) return super unless respond_to_missing?(method) instance.public_send(method, *args, &block) end
new()
click to toggle source
# File lib/snip_snip/registry.rb, line 7 def initialize clear end
respond_to_missing?(method)
click to toggle source
Respond to all of the missing methods on the singleton instance.
# File lib/snip_snip/registry.rb, line 42 def respond_to_missing?(method) instance.respond_to?(method) end
Public Instance Methods
clear()
click to toggle source
Wipe the registry clear of found objects so that we don't report on them twice.
# File lib/snip_snip/registry.rb, line 13 def clear @records = [] end
each_record(&block)
click to toggle source
Loop through each record that was found during the lifespan of this registry
# File lib/snip_snip/registry.rb, line 19 def each_record(&block) return to_enum(:each_record) unless block_given? records.each(&block) end
register(record)
click to toggle source
Add a record to this registry
# File lib/snip_snip/registry.rb, line 25 def register(record) records << record end