Sha256: f0adecf0962dd7c0c845e2edf0efe38e1a03fd8ac0064ff7be55ebe43e8fb930

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# -*- encoding: utf-8 -*-
# Author:: Couchbase <info@couchbase.com>
# Copyright:: 2012 Couchbase, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

def init
  xml = options[:xml_builder]
  xml.module(:name => object.name.to_s) do

    object.instance_mixins.each do |mixin|
      xml.instance_mixin mixin.path
    end

    object.class_mixins.each do |mixin|
      xml.class_mixin mixin.path
    end

    if object.respond_to?(:children)
      object.children.sort_by do |child|
        [
          child.type.to_s,
          child.respond_to?(:scope) ? child.scope.to_s : "",
          child.name.to_s
        ]
      end.each do |child|
        child.format(options.merge(:type => child.type))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yard-xml-0.2.0 lib/templates/default/module/xml/setup.rb