Sha256: 4fafa303e6a3945309cd46fc50b98845be2a86c5ffb01660b9a4101ed8da8e74

Contents?: true

Size: 535 Bytes

Versions: 10

Compression:

Stored size: 535 Bytes

Contents

module Weskit::WML
  class Items
    include Enumerable, Mixins::Container, Mixins::Validator

    attr_reader :contents

    def formatter
      @formatter or Formatter.default
    end

    def formatter= item
      raise_unless Formatter, item
      @formatter = item
    end

    def initialize *items
      @contents = []
      push *items
    end

    def to_s
      @contents.collect do |item|
        formatter.format_detached item, formatter
      end.join formatter.separator
    end

    alias_method :to_str, :to_s
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
weskit-0.3.6 lib/weskit/wml/items.rb
weskit-0.3.5 lib/weskit/wml/items.rb
weskit-0.3.4 lib/weskit/wml/items.rb
weskit-0.3.3 lib/weskit/wml/items.rb
weskit-0.3.2 lib/weskit/wml/items.rb
weskit-0.3.1 lib/weskit/wml/items.rb
weskit-0.3.0 lib/weskit/wml/items.rb
weskit-0.2.1 lib/weskit/wml/items.rb
weskit-0.2.0 lib/weskit/wml/items.rb
weskit-0.1.0 lib/weskit/wml/items.rb