Class: DocsKit::LandingConfig::Feature

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

Overview

One feature card: a lucide icon name, a title, and a short body.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, icon: nil, body: nil) ⇒ Feature

Returns a new instance of Feature.



125
126
127
# File 'lib/docs_kit/landing_config.rb', line 125

def initialize(title:, icon: nil, body: nil)
  super
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



124
125
126
# File 'lib/docs_kit/landing_config.rb', line 124

def body
  @body
end

#iconObject (readonly)

Returns the value of attribute icon

Returns:

  • (Object)

    the current value of icon



124
125
126
# File 'lib/docs_kit/landing_config.rb', line 124

def icon
  @icon
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



124
125
126
# File 'lib/docs_kit/landing_config.rb', line 124

def title
  @title
end

Class Method Details

.from(feature) ⇒ Object



129
130
131
132
133
134
# File 'lib/docs_kit/landing_config.rb', line 129

def self.from(feature)
  return feature if feature.is_a?(self)

  attrs = feature.to_h.transform_keys(&:to_sym)
  new(icon: attrs[:icon], title: attrs[:title], body: attrs[:body])
end