Class: Middleman::Emojifire::Content
- Inherits:
-
Object
- Object
- Middleman::Emojifire::Content
- Defined in:
- lib/middleman-emojifire/content.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #body_only ⇒ Object
- #include_body? ⇒ Boolean
-
#initialize(source) ⇒ Content
constructor
A new instance of Content.
- #to_s ⇒ Object
Constructor Details
#initialize(source) ⇒ Content
Returns a new instance of Content.
6 7 8 |
# File 'lib/middleman-emojifire/content.rb', line 6 def initialize(source) @source = source.to_s end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
4 5 6 |
# File 'lib/middleman-emojifire/content.rb', line 4 def source @source end |
Instance Method Details
#body_only ⇒ Object
14 15 16 17 18 |
# File 'lib/middleman-emojifire/content.rb', line 14 def body_only source.gsub(%r{<body.*?>(.*?)</body>}m) do |match| yield match end end |
#include_body? ⇒ Boolean
10 11 12 |
# File 'lib/middleman-emojifire/content.rb', line 10 def include_body? source =~ %r{<body.*?>.*?</body>}m ? true : false end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/middleman-emojifire/content.rb', line 20 def to_s source end |