Class: RSpecHTML::ReconstitutedElement
- Inherits:
-
Object
- Object
- RSpecHTML::ReconstitutedElement
- Defined in:
- lib/rspec_html/reconstituted_element.rb
Overview
Reconstructs an HTML representation of an element from provided parameters.
Instance Method Summary collapse
-
#initialize(tag, options) ⇒ ReconstitutedElement
constructor
A new instance of ReconstitutedElement.
- #to_s ⇒ Object
Constructor Details
#initialize(tag, options) ⇒ ReconstitutedElement
Returns a new instance of ReconstitutedElement.
6 7 8 9 |
# File 'lib/rspec_html/reconstituted_element.rb', line 6 def initialize(tag, ) @tag = tag = end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/rspec_html/reconstituted_element.rb', line 11 def to_s name = @tag.to_s.downcase return '#document' if name == 'document' return name if name == 'document' return "<#{name}#{shorthand_options} />" if .is_a?(String) return "<#{name}#{formatted_attributes} />" unless &.key?(:text) "<#{name}#{formatted_attributes}>#{@options[:text]}</#{name}>" end |