Sha256: 88464c0055976ae7b41c0d978b2e41f0ce19b417085b9b57d4a52d21ddac48e8

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

class BBCoder
  class Configuration
    @@tags = {}

    def [](value)
      @@tags[value]
    end

    def clear
      @@tags = {}
    end

    def remove name
      @@tags.delete(name.to_sym)
    end

    def tag(name, options = {}, &block)
      unless block.nil?
        block.binding.eval <<-EOS
          def meta; @meta; end
          def content; @content; end
          def singular?; @singularity; end
        EOS
      end
      @@tags[name.to_sym] = BBCoder::Tag.new(name.to_sym, options.merge(:block => block))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bbcoder-1.0.1 lib/bbcoder/configuration.rb