Sha256: 6c0c6a6c881137605d4464a99284c729878914941a36bd81a89b59f36574287b

Contents?: true

Size: 816 Bytes

Versions: 186

Compression:

Stored size: 816 Bytes

Contents

class CallbacksHandler < YARD::Handlers::Ruby::Legacy::Base
  handles /\Adefine_callback(\s|\()/

  def process
    callback_name = tokval(statement.tokens[2])
    attr_index = statement.comments.each_with_index {|c, i| break i if c[0] == ?@}
    if attr_index.is_a?(Fixnum)
      docstring = statement.comments[0...attr_index]
      attrs = statement.comments[attr_index..-1]
    else
      docstring = statement.comments
      attrs = []
    end

    yieldparams = ""
    attrs.reject! do |a|
      next unless a =~ /^@yield *(\[.*?\])/
      yieldparams = $1
      true
    end

    o = register(MethodObject.new(namespace, "on_#{callback_name}", scope))
    o.docstring = docstring + [
      "@return [void]",
      "@yield #{yieldparams} When the callback is run"
    ] + attrs
    o.signature = true
  end
end

Version data entries

186 entries across 93 versions & 6 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/haml-3.1.8/vendor/sass/yard/callbacks.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
classiccms-0.7.0 vendor/bundle/gems/haml-3.1.4/vendor/sass/yard/callbacks.rb
classiccms-0.7.0 vendor/bundle/gems/haml-3.1.5/vendor/sass/yard/callbacks.rb
classiccms-0.7.0 vendor/bundle/gems/haml-3.1.6/vendor/sass/yard/callbacks.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/haml-3.1.8/vendor/sass/yard/callbacks.rb