class RubyReportable::Filter
Public Class Methods
new(name)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 3 def initialize(name) @options = {} @options[:key] = name.to_s.downcase.gsub(' ', '_').gsub(/[^a-zA-Z_]+/, '') @options[:name] = name @options[:default] = nil @options[:require] = false end
Public Instance Methods
[](key)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 11 def [](key) @options[key] end
[]=(key, value)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 15 def []=(key, value) @options[key] = value end
default(&block)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 48 def default(&block) self[:default] = block end
input(type, &block)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 35 def input(type, &block) self[:input] = type self[:collection] = block end
key(key)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 27 def key(key) self[:key] = key end
logic(&block)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 44 def logic(&block) self[:logic] = block end
priority(value)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 23 def priority(value) self[:priority] = value end
require()
click to toggle source
# File lib/ruby_reportable/filter.rb, line 19 def require self[:require] = true end
use?(&block)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 31 def use?(&block) self[:use] = block end
valid?(&block)
click to toggle source
# File lib/ruby_reportable/filter.rb, line 40 def valid?(&block) self[:valid] = block end