transcoder 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Ben Schwarz
1
+ Copyright (c) 2010 Ben Schwarz
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -12,13 +12,9 @@ module Transcoder
12
12
  end
13
13
  end
14
14
 
15
- # Autoload that works with Rubygems,
16
- # rather than from the current $LOAD_PATH only
17
- require 'core_ext/autoload'
15
+ $LOAD_PATH << File.dirname(__FILE__) + "/transcoder/parser"
18
16
 
19
- $LOAD_PATH << File.dirname(__FILE__)
20
-
21
- require 'transcoder/parser/json'
22
- require 'transcoder/parser/xml'
23
- require 'transcoder/parser/feed'
24
- require 'transcoder/parser/yaml'
17
+ require 'json/identifier'
18
+ require 'xml/identifier'
19
+ require 'feed/identifier'
20
+ require 'yaml/identifier'
@@ -0,0 +1,5 @@
1
+ require 'simple-rss'
2
+
3
+ class Transcoder::Feed
4
+ Handler = SimpleRSS
5
+ end
@@ -1,12 +1,12 @@
1
- autoload :SimpleRSS, "simple-rss"
2
-
3
1
  module Transcoder
4
2
  class Feed < Parser
5
3
  identifier "application/atom+xml",
6
4
  "application/rss+xml"
5
+
6
+ autoload :Handler, "feed/handler"
7
7
 
8
8
  def self.parse(raw)
9
- SimpleRSS.parse(raw)
9
+ Feed::Handler.parse(raw)
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,5 @@
1
+ require 'json'
2
+
3
+ class Transcoder::Json
4
+ Handler = JSON
5
+ end
@@ -1,5 +1,3 @@
1
- autoload :JSON, "json"
2
-
3
1
  module Transcoder
4
2
  class Json < Parser
5
3
  identifier "application/json",
@@ -8,8 +6,10 @@ module Transcoder
8
6
  "text/x-javascript",
9
7
  "text/x-json"
10
8
 
9
+ autoload :Handler, "json/handler"
10
+
11
11
  def self.parse(raw)
12
- JSON.parse(raw)
12
+ Json::Handler.parse(raw)
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,5 @@
1
+ require 'crack'
2
+
3
+ class Transcoder::XML
4
+ Handler = Crack::XML
5
+ end
@@ -1,12 +1,12 @@
1
- autoload :Crack, "crack"
2
-
3
1
  module Transcoder
4
2
  class XML < Parser
5
3
  identifier "text/xml",
6
4
  "application/xml"
5
+
6
+ autoload :Handler, "xml/handler"
7
7
 
8
8
  def self.parse(raw)
9
- Crack::XML.parse(raw)
9
+ XML::Handler.parse(raw)
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,4 @@
1
+ # Autoload is fine, its apart of ruby-core.
1
2
  autoload :YAML, "yaml"
2
3
 
3
4
  module Transcoder
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{transcoder}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Schwarz"]
@@ -24,12 +24,14 @@ Gem::Specification.new do |s|
24
24
  "README.md",
25
25
  "Rakefile",
26
26
  "VERSION",
27
- "lib/core_ext/autoload.rb",
28
27
  "lib/transcoder.rb",
29
- "lib/transcoder/parser/feed.rb",
30
- "lib/transcoder/parser/json.rb",
31
- "lib/transcoder/parser/xml.rb",
32
- "lib/transcoder/parser/yaml.rb",
28
+ "lib/transcoder/parser/feed/handler.rb",
29
+ "lib/transcoder/parser/feed/identifier.rb",
30
+ "lib/transcoder/parser/json/handler.rb",
31
+ "lib/transcoder/parser/json/identifier.rb",
32
+ "lib/transcoder/parser/xml/handler.rb",
33
+ "lib/transcoder/parser/xml/identifier.rb",
34
+ "lib/transcoder/parser/yaml/identifier.rb",
33
35
  "spec/parser/feed_spec.rb",
34
36
  "spec/parser/json_spec.rb",
35
37
  "spec/parser/xml_spec.rb",
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Schwarz
@@ -110,12 +110,14 @@ files:
110
110
  - README.md
111
111
  - Rakefile
112
112
  - VERSION
113
- - lib/core_ext/autoload.rb
114
113
  - lib/transcoder.rb
115
- - lib/transcoder/parser/feed.rb
116
- - lib/transcoder/parser/json.rb
117
- - lib/transcoder/parser/xml.rb
118
- - lib/transcoder/parser/yaml.rb
114
+ - lib/transcoder/parser/feed/handler.rb
115
+ - lib/transcoder/parser/feed/identifier.rb
116
+ - lib/transcoder/parser/json/handler.rb
117
+ - lib/transcoder/parser/json/identifier.rb
118
+ - lib/transcoder/parser/xml/handler.rb
119
+ - lib/transcoder/parser/xml/identifier.rb
120
+ - lib/transcoder/parser/yaml/identifier.rb
119
121
  - spec/parser/feed_spec.rb
120
122
  - spec/parser/json_spec.rb
121
123
  - spec/parser/xml_spec.rb
@@ -1,27 +0,0 @@
1
- class Object
2
- class << self
3
- alias_method :_const_missing, :const_missing
4
- private :_const_missing
5
-
6
- def const_missing(constant)
7
- if Kernel._autoloads.key? constant
8
- require Kernel._autoloads[constant]
9
- const_get(constant)
10
- else
11
- _const_missing(constant)
12
- end
13
- end
14
- end
15
- end
16
-
17
- module Kernel
18
- module_function :autoload
19
-
20
- def _autoloads
21
- @@_autoloads
22
- end
23
-
24
- def autoload(const, path)
25
- (@@_autoloads||={})[const] = path
26
- end
27
- end