Class: Coradoc::Element::Audio
- Extended by:
- Coradoc::Element::AttributeList::Matchers
- Defined in:
- lib/coradoc/element/audio.rb
Constant Summary collapse
- VALIDATORS_NAMED =
{ title: String, start: Integer, end: Integer, options: many("nofollow", "noopener", "inline", "interactive"), opts: many("nofollow", "noopener", "inline", "interactive"), }
Instance Attribute Summary collapse
-
#anchor ⇒ Object
Returns the value of attribute anchor.
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#options ⇒ Object
Returns the value of attribute options.
-
#src ⇒ Object
Returns the value of attribute src.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, options = {}) ⇒ Audio
constructor
A new instance of Audio.
- #to_adoc ⇒ Object
Methods included from Coradoc::Element::AttributeList::Matchers
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(title, options = {}) ⇒ Audio
Returns a new instance of Audio.
8 9 10 11 12 13 14 |
# File 'lib/coradoc/element/audio.rb', line 8 def initialize(title, = {}) @title = title @id = .fetch(:id, nil) @anchor = Inline::Anchor.new(@id) if @id @src = .fetch(:src, "") @attributes = .fetch(:attributes, []) end |
Instance Attribute Details
#anchor ⇒ Object
Returns the value of attribute anchor.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def anchor @anchor end |
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def id @id end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def @options end |
#src ⇒ Object
Returns the value of attribute src.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def src @src end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/coradoc/element/audio.rb', line 4 def title @title end |
Instance Method Details
#to_adoc ⇒ Object
16 17 18 19 20 21 |
# File 'lib/coradoc/element/audio.rb', line 16 def to_adoc anchor = @anchor.nil? ? "" : "#{@anchor.to_adoc}\n" title = ".#{@title}\n" unless @title.empty? attrs = @attributes.empty? ? "\[\]" : @attributes.to_adoc [anchor, title, "audio::", @src, attrs].join("") end |