Sha256: 044a889680baefe3f7e24e6cc9d649a34804d3cfc3d36e451b025a92f1fe992f
Contents?: true
Size: 980 Bytes
Versions: 7
Compression:
Stored size: 980 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 # Registered views # # @api private # @since 0.1.0 def views @@views ||= [ self ] + subclasses.to_a end end end end
Version data entries
7 entries across 7 versions & 1 rubygems