opml-parser 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ html/
4
4
  pkg/
5
5
  .bundle
6
6
  *.swp
7
+ *.gem
8
+ *.tar.gz
@@ -2,7 +2,7 @@ module OpmlParser #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/opml-parser.rb CHANGED
@@ -10,24 +10,23 @@ require 'opml-parser/version'
10
10
  # Kevin Gillieron <kevin.gillieron@gw-computing.net>
11
11
  #
12
12
  module OpmlParser
13
- # Class representing an OPML outline element
13
+ # OPML outline element
14
14
  class Outline
15
- # OPML outline attributes (generally text, title, type, xmlUrl
16
- # and htmlUrl)
15
+ # Outline attributes (generally text, title, type, xmlUrl and htmlUrl)
17
16
  attr_reader :attributes
18
17
 
19
- # Initializes an outline object
18
+ # Initializes an Outline object
20
19
  #
21
20
  # Arguments:
22
21
  # attributes: (Hash) A Hash table that contains the attributes of the
23
22
  # outline.
24
23
  #
25
- def initialize(attributes=Hash.new)
24
+ def initialize(attributes={})
26
25
  @attributes = attributes
27
26
  end
28
27
  end
29
28
 
30
- # Import an OPML String as an array of Outline object
29
+ # Convert an OPML String to an array of Outline objects.
31
30
  #
32
31
  # Arguments:
33
32
  # contents: (String) A String that contains the OMPL
@@ -40,14 +39,15 @@ module OpmlParser
40
39
  end
41
40
  end
42
41
 
43
- # Import an OPML String as an array of Outline object
42
+ # Export an OPML String to an array of Outline objects.
44
43
  #
45
44
  # Arguments:
46
45
  # feeds: (Array of Outline) An array of Outline objects
47
- def export(feeds)
46
+ # title: (String) Title of the OPML document
47
+ def export(feeds, title="No title")
48
48
  builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
49
49
  xml.opml(version: "1.0") do
50
- xml.head { xml.title "RReader Exported Feeds" }
50
+ xml.head { xml.title title }
51
51
  xml.body { feeds.each { |outline| xml.outline(outline.attributes) }}
52
52
  end
53
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opml-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-11 00:00:00.000000000 Z
12
+ date: 2013-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri