Class: HakumiComponents::Documentation::Section

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/hakumi_components/documentation/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, description: nil, props: [], methods: [], events: [], slots: []) ⇒ Section

Returns a new instance of Section.



112
113
114
115
116
117
118
119
# File 'lib/hakumi_components/documentation/models.rb', line 112

def initialize(title:, description: nil, props: [], methods: [], events: [], slots: [])
  @title = title
  @description = description
  @props = props
  @methods = methods
  @events = events
  @slots = slots
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



125
126
127
# File 'lib/hakumi_components/documentation/models.rb', line 125

def description
  @description
end

#eventsObject (readonly)

Returns the value of attribute events.



134
135
136
# File 'lib/hakumi_components/documentation/models.rb', line 134

def events
  @events
end

#methodsObject (readonly)

Returns the value of attribute methods.



131
132
133
# File 'lib/hakumi_components/documentation/models.rb', line 131

def methods
  @methods
end

#propsObject (readonly)

Returns the value of attribute props.



128
129
130
# File 'lib/hakumi_components/documentation/models.rb', line 128

def props
  @props
end

#slotsObject (readonly)

Returns the value of attribute slots.



137
138
139
# File 'lib/hakumi_components/documentation/models.rb', line 137

def slots
  @slots
end

#titleObject (readonly)

Returns the value of attribute title.



122
123
124
# File 'lib/hakumi_components/documentation/models.rb', line 122

def title
  @title
end

Instance Method Details

#to_hObject



140
141
142
143
144
145
146
147
148
149
# File 'lib/hakumi_components/documentation/models.rb', line 140

def to_h
  {
    "title" => @title,
    "description" => @description,
    "props" => @props.map(&:to_h),
    "methods" => @methods.map(&:to_h),
    "events" => @events.map(&:to_h),
    "slots" => @slots.map(&:to_h)
  }
end