Sha256: 98a53f7699e4b2f2822878955335c35e93bd44137123d19abcc31f4c6b286d1f

Contents?: true

Size: 762 Bytes

Versions: 17

Compression:

Stored size: 762 Bytes

Contents

module Prospectus
  ##
  # Define list object that contains items
  class List
    def initialize(params = {})
      @options = params
    end

    def items
      @items ||= []
    end

    def check
      all, good_only = @options.values_at(:all, :good_only)
      items.select do |x|
        match = x.expected == x.actual
        true if all || (!match ^ good_only)
      end
    end
  end

  ##
  # DSL for wrapping eval of list files
  class ListDSL
    def initialize(list, params)
      @list = list
      @options = params
    end

    def item(&block)
      item = Item.new(@options)
      dsl = ItemDSL.new(item, @options)
      dsl.instance_eval(&block)
      @list.items << item
      item.list.items.each { |x| @list.items << x }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
prospectus-0.2.2 lib/prospectus/list.rb
prospectus-0.2.1 lib/prospectus/list.rb
prospectus-0.2.0 lib/prospectus/list.rb
prospectus-0.1.1 lib/prospectus/list.rb
prospectus-0.1.0 lib/prospectus/list.rb
prospectus-0.0.15 lib/prospectus/list.rb
prospectus-0.0.13 lib/prospectus/list.rb
prospectus-0.0.12 lib/prospectus/list.rb
prospectus-0.0.11 lib/prospectus/list.rb
prospectus-0.0.10 lib/prospectus/list.rb
prospectus-0.0.9 lib/prospectus/list.rb
prospectus-0.0.8 lib/prospectus/list.rb
prospectus-0.0.6 lib/prospectus/list.rb
prospectus-0.0.5 lib/prospectus/list.rb
prospectus-0.0.4 lib/prospectus/list.rb
prospectus-0.0.3 lib/prospectus/list.rb
prospectus-0.0.2 lib/prospectus/list.rb