named-routes 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .idea
2
+ .rvmrc
3
+ *.gem
data/.runrc ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ . /usr/local/rvm/scripts/rvm
3
+ __rvm_project_rvmrc $(pwd)
4
+
5
+ file=$1
6
+ if [[ $file =~ .js$ ]]; then exec thor js:generate $@; fi
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
@@ -0,0 +1,69 @@
1
+ module NamedRoutes
2
+ begin
3
+ require "active_support/concern"
4
+ Concern = ActiveSupport::Concern
5
+ rescue LoadError
6
+ # A typical module looks like this
7
+ #
8
+ # module M
9
+ # def self.included(base)
10
+ # base.send(:extend, ClassMethods)
11
+ # base.send(:include, InstanceMethods)
12
+ # scope :foo, :conditions => { :created_at => nil }
13
+ # end
14
+ #
15
+ # module ClassMethods
16
+ # def cm; puts 'I am a class method'; end
17
+ # end
18
+ #
19
+ # module InstanceMethods
20
+ # def im; puts 'I am an instance method'; end
21
+ # end
22
+ # end
23
+ #
24
+ # By using <tt>ActiveSupport::Concern</tt> the above module could instead be written as:
25
+ #
26
+ # module M
27
+ # extend ActiveSupport::Concern
28
+ #
29
+ # included do
30
+ # scope :foo, :conditions => { :created_at => nil }
31
+ # end
32
+ #
33
+ # module ClassMethods
34
+ # def cm; puts 'I am a class method'; end
35
+ # end
36
+ #
37
+ # module InstanceMethods
38
+ # def im; puts 'I am an instance method'; end
39
+ # end
40
+ # end
41
+ module Concern
42
+ def self.extended(base)
43
+ base.instance_variable_set("@_dependencies", [])
44
+ end
45
+
46
+ def append_features(base)
47
+ if base.instance_variable_defined?("@_dependencies")
48
+ base.instance_variable_get("@_dependencies") << self
49
+ return false
50
+ else
51
+ return false if base < self
52
+ @_dependencies.each { |dep| base.send(:include, dep) }
53
+ super
54
+ base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
55
+ base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods")
56
+ base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
57
+ end
58
+ end
59
+
60
+ def included(base = nil, &block)
61
+ if base.nil?
62
+ @_included_block = block
63
+ else
64
+ super
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{named-routes}
3
+ s.version = File.read("#{File.dirname(__FILE__)}/VERSION").strip
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Brian Takita"]
7
+ s.date = %q{2011-01-19}
8
+ s.email = %q{brian.takita@gmail.com}
9
+ # Man files are required because they are ignored by git
10
+ s.files = `git ls-files`.split("\n")
11
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ s.require_paths = ["lib"]
13
+ s.homepage = %q{http://github.com/btakita/named-routes}
14
+ s.rdoc_options = ["--main", "README.md", "--inline-source", "--line-numbers"]
15
+ s.require_paths = ["lib"]
16
+ s.rubygems_version = %q{1.3.7}
17
+ s.summary = %q{A simple and generic named routes api. It works really well with Sinatra.}
18
+
19
+ s.add_runtime_dependency "activesupport", ">=2.0.0"
20
+ end
21
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: named-routes
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.8
5
+ version: 0.2.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Takita
@@ -30,10 +30,11 @@ executables: []
30
30
 
31
31
  extensions: []
32
32
 
33
- extra_rdoc_files:
34
- - CHANGES
35
- - README.md
33
+ extra_rdoc_files: []
34
+
36
35
  files:
36
+ - .gitignore
37
+ - .runrc
37
38
  - CHANGES
38
39
  - Gemfile
39
40
  - Gemfile.lock
@@ -42,8 +43,10 @@ files:
42
43
  - Rakefile
43
44
  - VERSION
44
45
  - lib/named-routes.rb
46
+ - lib/named-routes/concern.rb
45
47
  - lib/named-routes/routes.rb
46
48
  - lib/named-routes/schemed_uri.rb
49
+ - named-routes.gemspec
47
50
  - spec/named-routes/routes_spec.rb
48
51
  - spec/spec_helper.rb
49
52
  has_rdoc: true