Class: TextMarker::Tag
- Inherits:
-
Object
- Object
- TextMarker::Tag
- Defined in:
- lib/textmarker/tag.rb
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#close_tag ⇒ Object
readonly
Returns the value of attribute close_tag.
-
#open_tag ⇒ Object
readonly
Returns the value of attribute open_tag.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#text_color ⇒ Object
Returns the value of attribute text_color.
Instance Method Summary collapse
-
#initialize(tag = :span, background_color = :yellow, text_color = :black) ⇒ Tag
constructor
A new instance of Tag.
- #to_s ⇒ Object
Constructor Details
#initialize(tag = :span, background_color = :yellow, text_color = :black) ⇒ Tag
Returns a new instance of Tag.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/textmarker/tag.rb', line 7 def initialize(tag=:span, background_color=:yellow, text_color=:black) @valid_tags = validate_tag(tag) validate_color(background_color) validate_color(text_color) @tag = tag @background_color = background_color @text_color = text_color @open_tag = generate_open_tag @close_tag = generate_close_tag end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
5 6 7 |
# File 'lib/textmarker/tag.rb', line 5 def background_color @background_color end |
#close_tag ⇒ Object (readonly)
Returns the value of attribute close_tag.
5 6 7 |
# File 'lib/textmarker/tag.rb', line 5 def close_tag @close_tag end |
#open_tag ⇒ Object (readonly)
Returns the value of attribute open_tag.
5 6 7 |
# File 'lib/textmarker/tag.rb', line 5 def open_tag @open_tag end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'lib/textmarker/tag.rb', line 5 def tag @tag end |
#text_color ⇒ Object
Returns the value of attribute text_color.
5 6 7 |
# File 'lib/textmarker/tag.rb', line 5 def text_color @text_color end |
Instance Method Details
#to_s ⇒ Object
22 23 24 |
# File 'lib/textmarker/tag.rb', line 22 def to_s generate_open_tag + generate_close_tag end |