Class: ImproveTypography::Base
- Inherits:
-
Struct
- Object
- Struct
- ImproveTypography::Base
- Defined in:
- lib/improve_typography/base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#str ⇒ Object
Returns the value of attribute str.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(str, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(str, options = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/improve_typography/base.rb', line 9 def initialize(str, = {}) super(str, ) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options
4 5 6 |
# File 'lib/improve_typography/base.rb', line 4 def @options end |
#str ⇒ Object
Returns the value of attribute str
4 5 6 |
# File 'lib/improve_typography/base.rb', line 4 def str @str end |
Class Method Details
.call(*args) ⇒ Object
5 6 7 |
# File 'lib/improve_typography/base.rb', line 5 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/improve_typography/base.rb', line 13 def call return str unless processor_classes.count > 0 doc.xpath('.//text()').each do |node| processor_classes.each do |processor| node.content = processor.call(node.content, ) end end CGI.unescapeHTML( doc.to_html.strip[5..-7] ) end |