Class: ContentBlockTools::EmbedCode
- Inherits:
-
Object
- Object
- ContentBlockTools::EmbedCode
- Defined in:
- lib/content_block_tools/embed_code.rb
Overview
Parses and represents an embed code string
An embed code identifies a content block and optionally specifies which fields to render. The format is:
{{embed:block_type:identifier}}
{{embed:block_type:identifier/field1/nested_field2}}
{{embed:block_type:identifier|format}}
{{embed:block_type:identifier/field1|format}}
Constant Summary collapse
- FORMAT_REGEX =
/\#(?<format>[^}#]+)}}$/
Instance Method Summary collapse
-
#format ⇒ String
Returns the format specifier from the embed code.
-
#initialize(embed_code_string) ⇒ EmbedCode
constructor
A new instance of EmbedCode.
-
#internal_content_path ⇒ InternalContentPath
Returns the internal content path for this embed code.
Constructor Details
#initialize(embed_code_string) ⇒ EmbedCode
Returns a new instance of EmbedCode.
26 27 28 |
# File 'lib/content_block_tools/embed_code.rb', line 26 def initialize() @embed_code_string = end |
Instance Method Details
#format ⇒ String
Returns the format specifier from the embed code
40 41 42 |
# File 'lib/content_block_tools/embed_code.rb', line 40 def format @format ||= parse_format end |
#internal_content_path ⇒ InternalContentPath
Returns the internal content path for this embed code
33 34 35 |
# File 'lib/content_block_tools/embed_code.rb', line 33 def internal_content_path @internal_content_path ||= InternalContentPath.new(parse_path_segments) end |