Sha256: 65851552729c8fcf672ce7c07950bddbf78b15ca076ebfb9bd7df8fdcac1d3d4
Contents?: true
Size: 558 Bytes
Versions: 1
Compression:
Stored size: 558 Bytes
Contents
module MVCLI class Middleware def initialize @apps = [] yield self if block_given? end def call(command, apps = @apps, &block) app, *rest = apps + [block].compact if app app.call(command) do |yielded| yielded ||= command call yielded, rest end else return 0 end end def [](idx) @apps[idx] end def []=(idx, app) @apps[idx] = app end def <<(app) @apps << app end def length @apps.length end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mvcli-0.1.0 | lib/mvcli/middleware.rb |