class JsDuck::Process::Ext4Events

Appends Ext4 options parameter to the parameter list of each event in each class.

But only does so when :ext4_events option is set to true or the code itself is detected as being writted in Ext4 style.

Constants

OPTIONS

Public Class Methods

new(classes, opts=OpenStruct.new) click to toggle source
# File lib/jsduck/process/ext4_events.rb, line 12
def initialize(classes, opts=OpenStruct.new)
  @classes = classes
  @opts = opts
end

Public Instance Methods

ext4_style_code?() click to toggle source

Are we dealing with code looking like ExtJS 4? True if any of the classes is defined with Ext.define()

# File lib/jsduck/process/ext4_events.rb, line 25
def ext4_style_code?
  @classes.values.any? {|cls| cls[:code_type] == :ext_define }
end
process(cls) click to toggle source
# File lib/jsduck/process/ext4_events.rb, line 29
def process(cls)
  cls[:members].each do |m|
    m[:params] << OPTIONS if m[:tagname] == :event
  end
end
process_all!() click to toggle source
# File lib/jsduck/process/ext4_events.rb, line 17
def process_all!
  if @opts.ext4_events == true || (@opts.ext4_events == nil && ext4_style_code?)
    @classes.each_value {|cls| process(cls) }
  end
end