Sha256: db1bd340ff532359f4f37fd0b699f068d28ec524f953094679730983511745db
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
require 'weakref' module Lita module Handlers class Enhance < Handler class Enhancer @@subclasses = [] @@current = %w(* *) @@old = %w(¿ ?) def self.all @@subclasses.select! {|x| x.weakref_alive? } @@subclasses end def self.inherited(subclass) @@subclasses << WeakRef.new(subclass) end attr_reader :redis def initialize(redis) @redis = redis end def render(node, level) "#{start_mark(node)}#{node.render(level)}#{end_mark(node)}" end def max_level 5 end private def start_mark(node) node.old? ? @@old.first : @@current.first end def end_mark(node) node.old? ? @@old.last : @@current.last end end class Substitution < Struct.new(:range, :new_text) def overlap?(other) range.cover?(other.range.begin) || other.range.cover?(range.end) end end require 'lita/handlers/enhance/enhancers/instance_id_enhancer' require 'lita/handlers/enhance/enhancers/ip_enhancer' require 'lita/handlers/enhance/enhancers/hostname_enhancer' require 'lita/handlers/enhance/enhancers/mac_address_enhancer' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lita-enhance-0.9.2 | lib/lita/handlers/enhance/enhancer.rb |
lita-enhance-0.9.1 | lib/lita/handlers/enhance/enhancer.rb |
lita-enhance-0.9.0 | lib/lita/handlers/enhance/enhancer.rb |