class JsDuck::Tag::Mixins
Public Class Methods
new()
click to toggle source
# File lib/jsduck/tag/mixins.rb, line 5 def initialize @pattern = ["mixin", "mixins"] @tagname = :mixins @repeatable = true @ext_define_pattern = "mixins" @ext_define_default = {:mixins => []} end
Public Instance Methods
parse_ext_define(cls, ast)
click to toggle source
Override
definition in parent class. In addition to Array literal, mixins can be defined with an object literal.
# File lib/jsduck/tag/mixins.rb, line 15 def parse_ext_define(cls, ast) cls[:mixins] = to_mixins_array(ast) end
to_mixins_array(ast)
click to toggle source
converts AstNode, whether it's a string, array or hash into array of strings (when possible).
# File lib/jsduck/tag/mixins.rb, line 21 def to_mixins_array(ast) v = ast.to_value mixins = v.is_a?(Hash) ? v.values : Array(v) mixins.all? {|mx| mx.is_a? String } ? mixins : [] end