Module: Feedjira::FeedUtilities::ClassMethods

Defined in:
lib/feedjira/feed_utilities.rb

Instance Method Summary collapse

Instance Method Details

#parse(xml, &block) ⇒ Object



15
16
17
18
19
# File 'lib/feedjira/feed_utilities.rb', line 15

def parse(xml, &block)
  xml = strip_whitespace(xml)
  xml = preprocess(xml) if preprocess_xml
  super xml, &block
end

#preprocess(xml) ⇒ Object



21
22
23
24
# File 'lib/feedjira/feed_utilities.rb', line 21

def preprocess(xml)
  # noop
  xml
end

#preprocess_xmlObject



30
31
32
# File 'lib/feedjira/feed_utilities.rb', line 30

def preprocess_xml
  @preprocess_xml
end

#preprocess_xml=(value) ⇒ Object



26
27
28
# File 'lib/feedjira/feed_utilities.rb', line 26

def preprocess_xml=(value)
  @preprocess_xml = value
end

#strip_whitespace(xml) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/feedjira/feed_utilities.rb', line 34

def strip_whitespace(xml)
  if Feedjira.strip_whitespace
    xml.strip
  else
    xml.lstrip
  end
end