Method: Brief::Document#extract_content

Defined in:
lib/brief/document.rb

#extract_content(*args) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/brief/document.rb', line 64

def extract_content(*args)
  options = args.extract_options!
  args    = options.delete(:args) if options.is_a?(Hash) && options.key?(:args)

  case
  when options.empty? && args.length == 1 && args.first.is_a?(String)
    results = css(args.first)
    results = results.first if results.length > 1 && args.first.match(/:first-of-type/)
    results.try(:text).to_s
  else
    binding.pry
  end
end