Sha256: 1f1d9d271db721cf84aa9dcdc91e6cb9f7050896838db60624a477dae1e3a34c

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

# Author::    Nicolas Desprès  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /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.3.1.2 lib/uttk/strategies/Composite/contents_eval.rb
uttk-0.3.6.1 lib/uttk/strategies/Composite/contents_eval.rb
uttk-0.3.5.0 lib/uttk/strategies/Composite/contents_eval.rb