Class: WCC::Contentful::RichText::Heading

Inherits:
Struct
  • Object
show all
Includes:
Node
Defined in:
lib/wcc/contentful/rich_text.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Node

#keys

Instance Attribute Details

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



158
159
160
# File 'lib/wcc/contentful/rich_text.rb', line 158

def content
  @content
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



158
159
160
# File 'lib/wcc/contentful/rich_text.rb', line 158

def data
  @data
end

#nodeTypeObject

Returns the value of attribute nodeType

Returns:

  • (Object)

    the current value of nodeType



158
159
160
# File 'lib/wcc/contentful/rich_text.rb', line 158

def nodeType
  @nodeType
end

Class Method Details

.matches?(node_type) ⇒ Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/wcc/contentful/rich_text.rb', line 162

def self.matches?(node_type)
  node_type =~ /heading-(\d+)/
end

Instance Method Details

#sizeObject



166
167
168
# File 'lib/wcc/contentful/rich_text.rb', line 166

def size
  @size ||= /heading-(\d+)/.match(nodeType)[1]&.to_i
end