Class: Brandish::Processors::Common::Group Abstract
- Inherits:
-
Brandish::Processor::Base
- Object
- Brandish::Processor::Base
- Brandish::Processors::Common::Group
- Includes:
- Brandish::Processor::Block
- Defined in:
- lib/brandish/processors/common/group.rb
Overview
Implement Brandish::Processor::Block#perform and register the processor with Brandish::Processor::Base.register.
A "group." This is for grouping together elements for styling or logical purposes. By default, this creates a block element.
This takes no options.
Pairs:
"class"
- Optional. See #class_value."id"
- Optional. See #id_value."name"
- Optional. See #name_value.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Brandish::Processor::Base
Instance Method Summary collapse
-
#accepted_body ⇒ ::String
The body, accepted and flattened.
-
#class_value ⇒ ::String
The class value of the group.
-
#id_value ⇒ ::String?
The ID value of the group.
-
#name_value ⇒ ::String?
The name value of the group.
Methods included from Brandish::Processor::Block
included, #perform, #process_block
Methods inherited from Brandish::Processor::Base
#accept, #call, #initialize, #postprocess, #process_block, #process_command, #process_root, #process_text, register, #setup
Constructor Details
This class inherits a constructor from Brandish::Processor::Base
Instance Method Details
#accepted_body ⇒ ::String
The body, accepted and flattened. This essentially converts the contents into a string that can be used as the value for the group.
61 62 63 |
# File 'lib/brandish/processors/common/group.rb', line 61 def accepted_body accept(@body).flatten end |
#class_value ⇒ ::String
The class value of the group. This can have a 1-to-1 correspondence
to the destination source. This works similarly to HTML's class
attribute. This uses the "class"
pair.
31 32 33 |
# File 'lib/brandish/processors/common/group.rb', line 31 def class_value @pairs.fetch("class", "") end |
#id_value ⇒ ::String?
The ID value of the group. This can have a 1-to-1 correspondence
to the destination source. This works similarly to HTML's id
attribute; especially the concept that it should be unique. This
uses the "id"
pair.
41 42 43 |
# File 'lib/brandish/processors/common/group.rb', line 41 def id_value @pairs["id"] end |
#name_value ⇒ ::String?
The name value of the group. This doesn't have a 1-to-1
correspondence to the destination source. This is used to provide
an internal styling or grouping process. This uses the "name"
pair.
51 52 53 |
# File 'lib/brandish/processors/common/group.rb', line 51 def name_value @pairs["name"] end |