module MemoRack::Plugin
Public Instance Methods
<=>(other)
click to toggle source
プラグインの優先順位を比較する
# File lib/memorack/plugin.rb, line 26 def <=>(other) r = - (self.priority <=> other.priority) return r unless r == 0 self.to_s <=> other.to_s end
[](key)
click to toggle source
ファイル拡張子からプラグインをみつける
# File lib/memorack/plugin.rb, line 42 def [](key) ext = File.extname(key)[1..-1] plugins.each { |plugin| return plugin if plugin.member?(key, ext) } nil end
extnames()
click to toggle source
# File lib/memorack/plugin.rb, line 37 def extnames [] end
inherited(subclass)
click to toggle source
サブクラスが追加されたらプラグインに登録する
# File lib/memorack/plugin.rb, line 11 def inherited(subclass) plugins << subclass end
member?(key, ext = nil)
click to toggle source
# File lib/memorack/plugin.rb, line 33 def member?(key, ext = nil) extnames.member?(ext) end
plugins()
click to toggle source
プラグイン一覧
# File lib/memorack/plugin.rb, line 16 def plugins @plugins ||= SortedSet.new end
priority()
click to toggle source
優先順位
# File lib/memorack/plugin.rb, line 21 def priority 1 end