Sha256: f822526c186a75ca277149f95e9ff86aa2174ec494636dea5a39adf23f29d4e1
Contents?: true
Size: 690 Bytes
Versions: 5
Compression:
Stored size: 690 Bytes
Contents
module DiviningRod class Definition attr_accessor :prc, :group, :opts, :parent def initialize(opts={}, &blk) @prc = blk @opts = Mash.new(opts) end def evaluate(request) result = nil child_result = nil if @prc.call(request) result = self unless self.children.empty? self.children.each do |child| child_result = child.evaluate(request) break if child_result end end end child_result || result end def tags @tags ||= opts[:tags] || [] end def children @children ||= [] end def format opts[:format] end end end
Version data entries
5 entries across 5 versions & 1 rubygems