class BetterRailsDebugger::Parser::Ruby::Extension

Public Class Methods

config_for(klass) click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 19
def self.config_for(klass)
  @@classes[klass]
end
name(extension_name) click to toggle source

Define the name of the extension.

# File lib/better_rails_debugger/parser/ruby/extension.rb, line 14
def self.name(extension_name)
  raise ArgumentError.new "Argument must define to_s method" unless extension_name.respond_to? :to_s
  @@classes[self.class][:name] = extension_name.to_s
end
new(processor) click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 31
def initialize(processor)
  @processor = processor
end
position(position) click to toggle source

Define the position of the extension. The position define when should be executed, if for example we have Ext1 and Ext2, with position 2 and 1, then Ext2 it's going to be executed before Ext1. This is useful for an extension that depends of another one

# File lib/better_rails_debugger/parser/ruby/extension.rb, line 7
def self.position(position)
  # TODO: Allow to set position before another extension of after that one
  raise ArgumentError.new "Expected Integer or Float" unless position.kind_of? Integer or position.kind_of? Float
  @@classes[self.class][:position] = position
end
sorted_extensions() click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 23
def self.sorted_extensions
  ::BetterRailsDebugger::Parser::Ruby::Extension.descendants.sort_by do |klass|
    config = config_for klass
    # Classes without position goes at bottom
    config[:position] || Float::INFINITY
  end
end

Public Instance Methods

run() click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 39
def run()
  raise ScriptError.new "Please, define run method"
end
setup() click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 35
def setup

end

Private Instance Methods

processor() click to toggle source
# File lib/better_rails_debugger/parser/ruby/extension.rb, line 45
def processor
  @processor
end