Module: Hanami::View::Inheritable

Defined in:
lib/hanami/view/inheritable.rb

Overview

Inheriting mechanisms

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#inherited(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register a view subclass

Examples:

require 'hanami/view'

class IndexView
  include Hanami::View
end

class JsonIndexView < IndexView
end

Since:

  • 0.1.0



21
22
23
# File 'lib/hanami/view/inheritable.rb', line 21

def inherited(base)
  subclasses.add base
end

#subclassesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set of registered subclasses

Since:

  • 0.1.0



29
30
31
# File 'lib/hanami/view/inheritable.rb', line 29

def subclasses
  @subclasses ||= Set.new
end