Class: RicherText::Fragment
- Inherits:
-
Object
- Object
- RicherText::Fragment
- Defined in:
- lib/richer_text/fragment.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #find_all(selector) ⇒ Object
-
#initialize(source) ⇒ Fragment
constructor
A new instance of Fragment.
Constructor Details
#initialize(source) ⇒ Fragment
Returns a new instance of Fragment.
11 12 13 |
# File 'lib/richer_text/fragment.rb', line 11 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/richer_text/fragment.rb', line 9 def source @source end |
Class Method Details
.parse(html) ⇒ Object
4 5 6 |
# File 'lib/richer_text/fragment.rb', line 4 def parse(html) new(Nokogiri::HTML.fragment(html)) end |
Instance Method Details
#find_all(selector) ⇒ Object
15 16 17 |
# File 'lib/richer_text/fragment.rb', line 15 def find_all(selector) source.css(selector) end |