Class: DocsKit::Registry::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/docs_kit/registry.rb

Overview

The default instance for a v2 page entry: readers + href + view_class resolved under the registry's view_namespace (nil until the class exists, preserving the no-dead-links behavior).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs, path_prefix, view_namespace) ⇒ Entry

Returns a new instance of Entry.



134
135
136
137
138
139
140
141
142
# File 'lib/docs_kit/registry.rb', line 134

def initialize(attrs, path_prefix, view_namespace)
  @slug = attrs[:slug]
  @title = attrs[:title]
  @group = attrs[:group]
  @icon = attrs[:icon]
  @view_name = attrs[:view]
  @view_namespace = view_namespace
  @href = "#{path_prefix}/#{@slug}"
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def group
  @group
end

#hrefObject (readonly)

Returns the value of attribute href.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def href
  @href
end

#iconObject (readonly)

Returns the value of attribute icon.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def icon
  @icon
end

#slugObject (readonly)

Returns the value of attribute slug.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def slug
  @slug
end

#titleObject (readonly)

Returns the value of attribute title.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def title
  @title
end

#view_nameObject (readonly)

Returns the value of attribute view_name.



132
133
134
# File 'lib/docs_kit/registry.rb', line 132

def view_name
  @view_name
end

Instance Method Details

#view_classObject

The authored Phlex page class, or nil until it's written.



145
146
147
148
149
# File 'lib/docs_kit/registry.rb', line 145

def view_class
  return unless @view_namespace

  "#{@view_namespace}::#{@view_name}".safe_constantize
end