Sha256: 9aba05aff3e9d0255dfb2dd523ca8731d4d557296edbf96075a2d9c447ff1f61

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

# Author::    Nicolas Desprès  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Composite/contents_eval.rb 8788 2005-09-27T14:23:19.686215Z ertai  $


module Uttk

  module Strategies

    class Composite < Strategy

      class ContentsEval

        def initialize(contents=[], &block)
          @contents = contents
          if block
            if block.arity == -1
              instance_eval(&block)
            else
              block[self]
            end
          end
        end

        attr_reader :contents

        def name(item_name, &block)
          contents << { item_name.to_s => HashEval.new(&block).hash }
        end

      end # class ContentsEval

    end # class Composite

  end # module Strategies

end # module Uttk


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.4.6.1 lib/uttk/strategies/Composite/contents_eval.rb
uttk-0.4.5.0 lib/uttk/strategies/Composite/contents_eval.rb
uttk-0.4.6.2 lib/uttk/strategies/Composite/contents_eval.rb