Class: HakumiComponents::Documentation::Example

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(name:, title:, description: nil, sandbox: false, content: nil) ⇒ Example

Returns a new instance of Example.



164
165
166
167
168
169
170
# File 'lib/hakumi_components/documentation/models.rb', line 164

def initialize(name:, title:, description: nil, sandbox: false, content: nil)
  @name = name
  @title = title
  @description = description
  @sandbox = sandbox
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



185
186
187
# File 'lib/hakumi_components/documentation/models.rb', line 185

def content
  @content
end

#descriptionObject (readonly)

Returns the value of attribute description.



179
180
181
# File 'lib/hakumi_components/documentation/models.rb', line 179

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



173
174
175
# File 'lib/hakumi_components/documentation/models.rb', line 173

def name
  @name
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



182
183
184
# File 'lib/hakumi_components/documentation/models.rb', line 182

def sandbox
  @sandbox
end

#titleObject (readonly)

Returns the value of attribute title.



176
177
178
# File 'lib/hakumi_components/documentation/models.rb', line 176

def title
  @title
end

Instance Method Details

#to_hObject



199
200
201
202
203
204
205
206
207
# File 'lib/hakumi_components/documentation/models.rb', line 199

def to_h
  {
    "name" => @name,
    "title" => @title,
    "description" => @description,
    "sandbox" => @sandbox,
    "content" => @content
  }
end

#with_content(content) ⇒ Object



188
189
190
191
192
193
194
195
196
# File 'lib/hakumi_components/documentation/models.rb', line 188

def with_content(content)
  self.class.new(
    name: @name,
    title: @title,
    description: @description,
    sandbox: @sandbox,
    content: content
  )
end