Sha256: 3f3d440038ae6412e194be93426189fc4ad96f558dc5f6b814644d69978b0252
Contents?: true
Size: 982 Bytes
Versions: 27
Compression:
Stored size: 982 Bytes
Contents
module Hanami module View # Inheriting mechanisms # # @since 0.1.0 module Inheritable # Register a view subclass # # @api private # @since 0.1.0 # # @example # require 'hanami/view' # # class IndexView # include Hanami::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 Hanami::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
27 entries across 27 versions & 1 rubygems