Sha256: 00c44b96caacb036b621958adce3e1b3938e7e674f615802db3075b1c0ad2803

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

module Lookbook
  module Tags
    def define_tag(name, args = nil, opts = {}, &block)
      name = name.to_s.downcase.underscore.to_sym
      if args.is_a? Hash
        opts = args
        args = nil
      end
      opts[:args] = args
      opts[:parser] = block if block_given?
      Lookbook.config.preview_tags[name] = opts
    end

    def self.process_tags(tag_objects)
      return [] if tag_objects.none?
      tag_objects.map do |tag_object|
        opts = Lookbook.config.preview_tags[tag_object.tag_name] || {}
        Lookbook::Tag.new(tag_object, opts[:args], opts.except(:args))
      end.compact
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.7 lib/lookbook/tags.rb