Class: RicherText::Fragment

Inherits:
Object
  • Object
show all
Defined in:
lib/richer_text/fragment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#sourceObject (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