Sha256: 768057c19626f229fe50d9c20964ea11dc71abe2683f7adeef86e42e79711279
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
module Lotus module View # Inheriting mechanisms # # @since 0.1.0 module Inheritable # Register a view subclass # # @api private # @since 0.1.0 # # @example # require 'lotus/view' # # class IndexView # include Lotus::View # end # # class JsonIndexView < IndexView # end def inherited(base) subclasses.add base end # Set of registered subclasses # # @api private # @since 0.1.0 def subclasses @@subclasses ||= Set.new end protected # Loading mechanism hook. # # @api private # @since 0.1.0 # # @see Lotus::View.load! def load! subclasses.freeze views.freeze end def views @@views ||= [ self ] + subclasses.to_a end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lotus-view-0.1.0 | lib/lotus/view/inheritable.rb |