lookup 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ pkg
2
+ doc
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+ gem 'activerecord'
3
+ gem 'nokogiri'
4
+ gem 'find_by_hash'
5
+ gem 'sqlite3-ruby'
6
+
7
+ group :test do
8
+ gem 'rspec', '~> 2.0.0.beta.20'
9
+ gem 'webmock'
10
+ end
@@ -0,0 +1,47 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.0.0)
5
+ activesupport (= 3.0.0)
6
+ builder (~> 2.1.2)
7
+ i18n (~> 0.4.1)
8
+ activerecord (3.0.0)
9
+ activemodel (= 3.0.0)
10
+ activesupport (= 3.0.0)
11
+ arel (~> 1.0.0)
12
+ tzinfo (~> 0.3.23)
13
+ activesupport (3.0.0)
14
+ addressable (2.2.0)
15
+ arel (1.0.1)
16
+ activesupport (~> 3.0.0)
17
+ builder (2.1.2)
18
+ crack (0.1.8)
19
+ diff-lcs (1.1.2)
20
+ find_by_hash (0.0.1)
21
+ activerecord
22
+ i18n (0.4.1)
23
+ nokogiri (1.4.3.1)
24
+ rspec (2.0.0.beta.20)
25
+ rspec-core (= 2.0.0.beta.20)
26
+ rspec-expectations (= 2.0.0.beta.20)
27
+ rspec-mocks (= 2.0.0.beta.20)
28
+ rspec-core (2.0.0.beta.20)
29
+ rspec-expectations (2.0.0.beta.20)
30
+ diff-lcs (>= 1.1.2)
31
+ rspec-mocks (2.0.0.beta.20)
32
+ sqlite3-ruby (1.3.1)
33
+ tzinfo (0.3.23)
34
+ webmock (1.3.5)
35
+ addressable (>= 2.1.1)
36
+ crack (>= 0.1.7)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ activerecord
43
+ find_by_hash
44
+ nokogiri
45
+ rspec (~> 2.0.0.beta.20)
46
+ sqlite3-ruby
47
+ webmock
data/Rakefile CHANGED
@@ -1,53 +1,2 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rubygems/specification'
4
- require 'spec/rake/spectask'
5
-
6
- require 'jeweler'
7
- AUTHOR = "Ryan Bigg"
8
- EMAIL = "radarlistener@gmail.com"
9
- HOMEPAGE = "http://ryanbigg.com"
10
- SUMMARY = "A gem that provides a lazy man's ri"
11
-
12
- Jeweler::Tasks.new do |s|
13
- s.name = "lookup"
14
- s.version = File.read("VERSION")
15
- s.platform = Gem::Platform::RUBY
16
- s.has_rdoc = false
17
- s.summary = SUMMARY
18
- s.description = s.summary
19
- s.author = AUTHOR
20
- s.email = EMAIL
21
- s.homepage = HOMEPAGE
22
- s.executables << "lookup"
23
-
24
- s.add_dependency("sqlite3-ruby", ">=1.2.5")
25
- s.add_dependency("nokogiri")
26
- s.add_dependency("activerecord", ">= 2.3.8")
27
- s.add_development_dependency("webmock")
28
-
29
- s.require_path = 'lib'
30
- s.autorequire = "lookup"
31
- s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,spec,bin,doc}/**/*")
32
- end
33
-
34
- Jeweler::GemcutterTasks.new
35
-
36
- begin
37
- require 'spec'
38
- rescue LoadError
39
- require 'rubygems'
40
- require 'spec'
41
- end
42
-
43
- require 'spec/rake/spectask'
44
- desc 'Default: run unit tests.'
45
- task :default => :spec
46
-
47
- desc "Run the specs under spec"
48
- Spec::Rake::SpecTask.new do |t|
49
- t.spec_files = FileList['spec/**/*_spec.rb']
50
- t.libs = %w(lib spec)
51
- t.spec_opts << "-c"
52
- t.ruby_opts << "-rubygems"
53
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/lookup CHANGED
@@ -75,6 +75,6 @@ if search_string.strip.empty?
75
75
  puts op.help
76
76
  puts
77
77
  else
78
- results=APILookup.search(search_string)
78
+ results=Lookup.search(search_string)
79
79
  display_results(results, search_string)
80
80
  end
@@ -0,0 +1,2 @@
1
+ `sudo cp lookup.rb /usr/bin/lookup`
2
+ `sudo chmod +x /usr/bin/lookup`
@@ -6,7 +6,7 @@ Bundler.setup
6
6
  Bundler.require(:default)
7
7
  require 'active_record'
8
8
 
9
- module APILookup
9
+ module Lookup
10
10
 
11
11
  class << self
12
12
  def update!
@@ -0,0 +1,3 @@
1
+ module Lookup
2
+ VERSION = "1.0.0.beta2"
3
+ end
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- module APILookup
3
+ module Lookup
4
4
 
5
5
  class MissingHome < StandardError
6
6
  end
@@ -20,7 +20,7 @@ module APILookup
20
20
 
21
21
  class Api < LookupBase
22
22
  set_table_name "apis"
23
- has_many :constants, :class_name => "APILookup::Constant"
23
+ has_many :constants, :class_name => "Lookup::Constant"
24
24
  has_many :entries, :through => :constants
25
25
 
26
26
  def update_methods!
@@ -60,13 +60,13 @@ module APILookup
60
60
 
61
61
  class Constant < LookupBase
62
62
  set_table_name "constants"
63
- belongs_to :api, :class_name => "APILookup::Api"
64
- has_many :entries, :class_name => "APILookup::Entry"
63
+ belongs_to :api, :class_name => "Lookup::Api"
64
+ has_many :entries, :class_name => "Lookup::Entry"
65
65
  end
66
66
 
67
67
  class Entry < LookupBase
68
68
  set_table_name "entries"
69
- belongs_to :constant, :class_name => "APILookup::Constant"
69
+ belongs_to :constant, :class_name => "Lookup::Constant"
70
70
 
71
71
  delegate :api, :to => :constant
72
72
  end
@@ -75,7 +75,7 @@ end
75
75
 
76
76
  class SetupTables < ActiveRecord::Migration
77
77
  def self.connection
78
- APILookup::Api.connection
78
+ Lookup::Api.connection
79
79
  end
80
80
 
81
81
  def self.up
@@ -101,9 +101,9 @@ end
101
101
 
102
102
  FileUtils.mkdir_p(File.join(ENV["HOME"],".lookup"))
103
103
 
104
- if !APILookup::Api.table_exists? &&
105
- !APILookup::Constant.table_exists? &&
106
- !APILookup::Entry.table_exists?
104
+ if !Lookup::Api.table_exists? &&
105
+ !Lookup::Constant.table_exists? &&
106
+ !Lookup::Entry.table_exists?
107
107
  SetupTables.up
108
- APILookup.update!
108
+ Lookup.update!
109
109
  end
@@ -0,0 +1,32 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ # -*- encoding: utf-8 -*-
7
+ require File.expand_path("../lib/lookup/version", __FILE__)
8
+
9
+ Gem::Specification.new do |s|
10
+ s.name = "lookup"
11
+ s.version = Lookup::VERSION
12
+ s.platform = Gem::Platform::RUBY
13
+ s.authors = ["Ryan Bigg"]
14
+ s.email = ["radarlistener@gmail.com"]
15
+ s.homepage = "http://rubygems.org/gems/lookup"
16
+ s.summary = "A gem that provides a lazy man's ri"
17
+ s.description = "A gem that provides a lazy man's ri"
18
+
19
+ s.required_rubygems_version = ">= 1.3.6"
20
+ s.rubyforge_project = "lookup"
21
+
22
+ s.add_development_dependency "bundler", ">= 1.0.0"
23
+
24
+ s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
25
+ s.add_dependency(%q<nokogiri>, [">= 0"])
26
+ s.add_dependency(%q<activerecord>, [">= 2.3.8"])
27
+ s.add_dependency(%q<webmock>, [">= 0"])
28
+
29
+ s.files = `git ls-files`.split("\n")
30
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
31
+ s.require_path = 'lib'
32
+ end
@@ -2,11 +2,11 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe "Lookup" do
4
4
  before(:all) do
5
- # APILookup.update!
5
+ # Lookup.update!
6
6
  end
7
7
 
8
8
  def find_api(name)
9
- APILookup::Api.find_by_name(name)
9
+ Lookup::Api.find_by_name(name)
10
10
  end
11
11
 
12
12
  def find_constant(api, name)
@@ -18,7 +18,7 @@ describe "Lookup" do
18
18
  end
19
19
 
20
20
  def search(term, options={})
21
- APILookup.search(term, options)
21
+ Lookup.search(term, options)
22
22
  end
23
23
 
24
24
  it "should be able to find a method in Ruby 1.9" do
@@ -72,7 +72,7 @@ describe "Lookup" do
72
72
  it "should be able to find it if a hash-symbol is specified" do
73
73
  # sort_by used here because once it returned it out of order.
74
74
  # Ensure order.
75
- APILookup.search("v2.3.8 #today?").should eql([ find_entry("Rails v2.3.8", "ActiveSupport::CoreExtensions::Date::Calculations", "today?"),
75
+ Lookup.search("v2.3.8 #today?").should eql([ find_entry("Rails v2.3.8", "ActiveSupport::CoreExtensions::Date::Calculations", "today?"),
76
76
  find_entry("Rails v2.3.8", "ActiveSupport::TimeWithZone", "today?"),
77
77
  find_entry("Rails v2.3.8", "ActiveSupport::CoreExtensions::Time::Calculations", "today?")
78
78
  ].flatten!.sort_by(&:id))
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe "testing for regressions" do
4
4
  it "should not fail if an initial hash is specified" do
5
- lambda { APILookup.search("v2.3.8 #today?") }.should_not raise_error
5
+ lambda { Lookup.search("v2.3.8 #today?") }.should_not raise_error
6
6
  end
7
7
 
8
8
  end
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookup
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230051
4
+ hash: -1848230054
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta1
11
- version: 1.0.0.beta1
10
+ - beta2
11
+ version: 1.0.0.beta2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Ryan Bigg
15
- autorequire: lookup
15
+ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
@@ -20,9 +20,25 @@ date: 2010-09-10 00:00:00 +10:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: sqlite3-ruby
23
+ name: bundler
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 1
33
+ - 0
34
+ - 0
35
+ version: 1.0.0
36
+ type: :development
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: sqlite3-ruby
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
26
42
  none: false
27
43
  requirements:
28
44
  - - ">="
@@ -34,11 +50,11 @@ dependencies:
34
50
  - 5
35
51
  version: 1.2.5
36
52
  type: :runtime
37
- version_requirements: *id001
53
+ version_requirements: *id002
38
54
  - !ruby/object:Gem::Dependency
39
55
  name: nokogiri
40
56
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
42
58
  none: false
43
59
  requirements:
44
60
  - - ">="
@@ -48,11 +64,11 @@ dependencies:
48
64
  - 0
49
65
  version: "0"
50
66
  type: :runtime
51
- version_requirements: *id002
67
+ version_requirements: *id003
52
68
  - !ruby/object:Gem::Dependency
53
69
  name: activerecord
54
70
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
56
72
  none: false
57
73
  requirements:
58
74
  - - ">="
@@ -64,11 +80,11 @@ dependencies:
64
80
  - 8
65
81
  version: 2.3.8
66
82
  type: :runtime
67
- version_requirements: *id003
83
+ version_requirements: *id004
68
84
  - !ruby/object:Gem::Dependency
69
85
  name: webmock
70
86
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
87
+ requirement: &id005 !ruby/object:Gem::Requirement
72
88
  none: false
73
89
  requirements:
74
90
  - - ">="
@@ -77,42 +93,32 @@ dependencies:
77
93
  segments:
78
94
  - 0
79
95
  version: "0"
80
- type: :development
81
- version_requirements: *id004
96
+ type: :runtime
97
+ version_requirements: *id005
82
98
  description: A gem that provides a lazy man's ri
83
- email: radarlistener@gmail.com
99
+ email:
100
+ - radarlistener@gmail.com
84
101
  executables:
85
102
  - lookup
86
- - lookup
87
103
  extensions: []
88
104
 
89
- extra_rdoc_files:
90
- - LICENSE
91
- - README.md
92
- - TODO
105
+ extra_rdoc_files: []
106
+
93
107
  files:
108
+ - .gitignore
109
+ - Gemfile
110
+ - Gemfile.lock
94
111
  - LICENSE
95
112
  - README.md
96
113
  - Rakefile
97
- - TODO
98
114
  - bin/lookup
99
- - doc/classes/APILookup.src/M000003.html
100
- - doc/classes/APILookup.src/M000004.html
101
- - doc/classes/APILookup.src/M000005.html
102
- - doc/classes/APILookup.src/M000006.html
103
- - doc/classes/APILookup.src/M000007.html
104
- - doc/classes/APILookup.src/M000008.html
105
- - doc/classes/APILookup.src/M000009.html
106
- - doc/classes/APILookup/Api.src/M000010.html
107
- - doc/classes/APILookup/Api.src/M000011.html
108
- - doc/classes/SetupTables.src/M000001.html
109
- - doc/classes/SetupTables.src/M000002.html
110
- - doc/files/lib/lookup_rb.html
111
- - doc/files/lib/lookup_sqlite3.html
112
- - doc/rdoc-style.css
115
+ - install.rb
113
116
  - lib/lookup.rb
114
117
  - lib/lookup.sqlite3
118
+ - lib/lookup/version.rb
115
119
  - lib/models.rb
120
+ - lookup.gemspec
121
+ - spec/.lookup/lookup.sqlite3
116
122
  - spec/apis/1.8/classes.html
117
123
  - spec/apis/1.8/methods.html
118
124
  - spec/apis/1.9/classes.html
@@ -124,13 +130,13 @@ files:
124
130
  - spec/lookup_spec.rb
125
131
  - spec/regressions_spec.rb
126
132
  - spec/spec_helper.rb
127
- has_rdoc: false
128
- homepage: http://ryanbigg.com
133
+ has_rdoc: true
134
+ homepage: http://rubygems.org/gems/lookup
129
135
  licenses: []
130
136
 
131
137
  post_install_message:
132
- rdoc_options:
133
- - --charset=UTF-8
138
+ rdoc_options: []
139
+
134
140
  require_paths:
135
141
  - lib
136
142
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -145,22 +151,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
151
  required_rubygems_version: !ruby/object:Gem::Requirement
146
152
  none: false
147
153
  requirements:
148
- - - ">"
154
+ - - ">="
149
155
  - !ruby/object:Gem::Version
150
- hash: 25
156
+ hash: 23
151
157
  segments:
152
158
  - 1
153
159
  - 3
154
- - 1
155
- version: 1.3.1
160
+ - 6
161
+ version: 1.3.6
156
162
  requirements: []
157
163
 
158
- rubyforge_project:
164
+ rubyforge_project: lookup
159
165
  rubygems_version: 1.3.7
160
166
  signing_key:
161
167
  specification_version: 3
162
168
  summary: A gem that provides a lazy man's ri
163
- test_files:
164
- - spec/lookup_spec.rb
165
- - spec/regressions_spec.rb
166
- - spec/spec_helper.rb
169
+ test_files: []
170
+
data/TODO DELETED
@@ -1,2 +0,0 @@
1
- TODO:
2
- Test the bloody thing.
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>update! (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 11</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update!</span>
15
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Updating API, this may take a minute or two. Please be patient!&quot;</span>
16
- [<span class="ruby-constant">Constant</span>, <span class="ruby-constant">Entry</span>, <span class="ruby-constant">Api</span>].<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">klass</span><span class="ruby-operator">|</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">delete_all</span> }
17
-
18
- <span class="ruby-identifier">update_api!</span>(<span class="ruby-value str">&quot;Rails&quot;</span>, <span class="ruby-value str">&quot;http://api.rubyonrails.org&quot;</span>)
19
- <span class="ruby-identifier">update_api!</span>(<span class="ruby-value str">&quot;Ruby 1.8.7&quot;</span>, <span class="ruby-value str">&quot;http://www.ruby-doc.org/core&quot;</span>)
20
- <span class="ruby-identifier">update_api!</span>(<span class="ruby-value str">&quot;Ruby 1.9&quot;</span>, <span class="ruby-value str">&quot;http://ruby-doc.org/ruby-1.9&quot;</span>)
21
-
22
- <span class="ruby-keyword kw">end</span></pre>
23
- </body>
24
- </html>
@@ -1,22 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>update_api! (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 21</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_api!</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">url</span>)
15
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Updating API for #{name}...&quot;</span>
16
- <span class="ruby-identifier">api</span> = <span class="ruby-constant">Api</span>.<span class="ruby-identifier">find_or_create_by_name_and_url</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">url</span>)
17
- <span class="ruby-identifier">api</span>.<span class="ruby-identifier">update_methods!</span>
18
- <span class="ruby-identifier">api</span>.<span class="ruby-identifier">update_classes!</span>
19
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;DONE (with #{name})!&quot;</span>
20
- <span class="ruby-keyword kw">end</span></pre>
21
- </body>
22
- </html>
@@ -1,33 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>find_constant (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 29</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_constant</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">entry</span>=<span class="ruby-keyword kw">nil</span>)
15
- <span class="ruby-comment cmt"># Find by specific name.</span>
16
- <span class="ruby-identifier">constants</span> = <span class="ruby-constant">Constant</span>.<span class="ruby-identifier">find_all_by_name</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">:include</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;entries&quot;</span>)
17
- <span class="ruby-comment cmt"># search for class methods, which is prolly what we want if we can find it</span>
18
- <span class="ruby-identifier">constants</span> = <span class="ruby-constant">Constant</span>.<span class="ruby-identifier">find_all_by_name</span>(<span class="ruby-node">&quot;#{name}::ClassMethods&quot;</span>, <span class="ruby-identifier">:include</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;entries&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">empty?</span>
19
- <span class="ruby-comment cmt"># Find by name beginning with &lt;blah&gt;.</span>
20
- <span class="ruby-identifier">constants</span> = <span class="ruby-constant">Constant</span>.<span class="ruby-identifier">all</span>(<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;name LIKE ?&quot;</span>, <span class="ruby-identifier">name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;%&quot;</span>], <span class="ruby-identifier">:include</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;entries&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">empty?</span>
21
- <span class="ruby-comment cmt"># Find by fuzzy.</span>
22
- <span class="ruby-identifier">match</span>=<span class="ruby-node">&quot;%#{name.split(&quot;&quot;).join(&quot;%&quot;)}%&quot;</span>
23
- <span class="ruby-identifier">constants</span> = <span class="ruby-constant">Constant</span>.<span class="ruby-identifier">find_by_sql</span>(<span class="ruby-node">&quot;select * from constants where name LIKE '#{match}'&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">empty?</span>
24
- <span class="ruby-identifier">regex</span>=<span class="ruby-identifier">build_regex_from_constant</span>(<span class="ruby-identifier">name</span>)
25
- <span class="ruby-identifier">constants</span> = <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">regex</span> }
26
- <span class="ruby-comment cmt"># Narrow it down to the constants that only contain the entry we are looking for.</span>
27
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>
28
- <span class="ruby-identifier">constants</span> = <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">constant</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span><span class="ruby-identifier">constant</span>.<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">find_by_name</span>(<span class="ruby-identifier">entry</span>).<span class="ruby-identifier">nil?</span> }
29
- <span class="ruby-keyword kw">end</span>
30
- <span class="ruby-identifier">constants</span>
31
- <span class="ruby-keyword kw">end</span></pre>
32
- </body>
33
- </html>
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>build_regex_from_constant (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 51</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_regex_from_constant</span>(<span class="ruby-identifier">name</span>)
15
- <span class="ruby-identifier">parts</span>=<span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
16
- <span class="ruby-identifier">c</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;&quot;</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;[^:]*&quot;</span>)<span class="ruby-operator">+</span><span class="ruby-value str">&quot;[^:]*&quot;</span>
17
- <span class="ruby-keyword kw">end</span>
18
- <span class="ruby-node">/#{parts.join(&quot;::&quot;)}/i</span>
19
- <span class="ruby-keyword kw">end</span></pre>
20
- </body>
21
- </html>
@@ -1,33 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>smart_rails_constant_substitutions (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 58</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">smart_rails_constant_substitutions</span>(<span class="ruby-identifier">name</span>)
15
- <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;:&quot;</span>)}.<span class="ruby-identifier">flatten</span>
16
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">first</span>
17
- <span class="ruby-identifier">rep</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">downcase</span>
18
- <span class="ruby-comment cmt"># so it falls back on fuzzy and matches AR as well as ActiveResource</span>
19
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;ar&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActiveRecord&quot;</span>
20
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;ares&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActiveResource&quot;</span>
21
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;am&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActionMailer&quot;</span>
22
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;as&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActiveSupport&quot;</span>
23
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;ac&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActionController&quot;</span>
24
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;av&quot;</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">&quot;ActionView&quot;</span>
25
- <span class="ruby-keyword kw">else</span>
26
- <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">first</span>
27
- <span class="ruby-keyword kw">end</span>
28
- <span class="ruby-keyword kw">return</span> ([<span class="ruby-identifier">rep</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;::&quot;</span>)
29
- <span class="ruby-keyword kw">end</span>
30
- <span class="ruby-identifier">name</span>
31
- <span class="ruby-keyword kw">end</span></pre>
32
- </body>
33
- </html>
@@ -1,35 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>find_method (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 79</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_method</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">constant</span>=<span class="ruby-keyword kw">nil</span>)
15
- <span class="ruby-identifier">methods</span> = []
16
- <span class="ruby-comment cmt"># Full match</span>
17
- <span class="ruby-identifier">methods</span> = <span class="ruby-constant">Entry</span>.<span class="ruby-identifier">find_all_by_name</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
18
- <span class="ruby-comment cmt"># Start match</span>
19
- <span class="ruby-identifier">methods</span> = <span class="ruby-constant">Entry</span>.<span class="ruby-identifier">all</span>(<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">&quot;name LIKE ?&quot;</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;%&quot;</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">empty?</span>
20
- <span class="ruby-comment cmt"># Wildcard substitution</span>
21
- <span class="ruby-identifier">methods</span> = <span class="ruby-constant">Entry</span>.<span class="ruby-identifier">find_by_sql</span>(<span class="ruby-node">&quot;select * from entries where name LIKE '#{name.to_s.gsub(&quot;*&quot;, &quot;%&quot;)}'&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">empty?</span>
22
- <span class="ruby-comment cmt"># Fuzzy match</span>
23
- <span class="ruby-identifier">methods</span> = <span class="ruby-constant">Entry</span>.<span class="ruby-identifier">find_by_sql</span>(<span class="ruby-node">&quot;select * from entries where name LIKE '%#{name.to_s.split(&quot;&quot;).join(&quot;%&quot;)}%'&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">empty?</span>
24
-
25
- <span class="ruby-comment cmt"># Weight the results, last result is the first one we want shown first</span>
26
- <span class="ruby-identifier">methods</span> = <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">sort_by</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:weighting</span>)
27
-
28
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">constant</span>
29
- <span class="ruby-identifier">constants</span> = <span class="ruby-identifier">find_constant</span>(<span class="ruby-identifier">constant</span>)
30
- <span class="ruby-identifier">methods</span> = <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">constants</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">constant</span>) }
31
- <span class="ruby-keyword kw">end</span>
32
- <span class="ruby-identifier">methods</span>
33
- <span class="ruby-keyword kw">end</span></pre>
34
- </body>
35
- </html>
@@ -1,52 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>search (APILookup)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/lookup.rb, line 100</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">options</span>={})
15
- <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:api</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/^1\.9/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">msg</span>)
16
- <span class="ruby-value str">&quot;Ruby 1.9&quot;</span>
17
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-regexp re">/^1\.8/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">msg</span>)
18
- <span class="ruby-value str">&quot;Ruby 1.8.7&quot;</span>
19
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-regexp re">/^Rails/i</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">msg</span>)
20
- <span class="ruby-value str">&quot;Rails&quot;</span>
21
- <span class="ruby-keyword kw">end</span>
22
-
23
- <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^(.*?)\s/</span>, <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:api</span>]
24
-
25
- <span class="ruby-identifier">splitter</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:splitter</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;#&quot;</span>
26
- <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot; &quot;</span>)[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">splitter</span>) }.<span class="ruby-identifier">flatten!</span>
27
- <span class="ruby-comment cmt"># It's a constant! Oh... and there's nothing else in the string!</span>
28
- <span class="ruby-identifier">first</span> = <span class="ruby-identifier">smart_rails_constant_substitutions</span>(<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">first</span>)
29
- <span class="ruby-identifier">output</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/^[A-Z]/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">first</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
30
- <span class="ruby-identifier">find_constant</span>(<span class="ruby-identifier">first</span>)
31
- <span class="ruby-comment cmt"># It's a method!</span>
32
- <span class="ruby-keyword kw">else</span>
33
- <span class="ruby-comment cmt"># Right, so they only specified one argument. Therefore, we look everywhere.</span>
34
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
35
- <span class="ruby-identifier">o</span> = <span class="ruby-identifier">find_method</span>(<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">last</span>)
36
- <span class="ruby-comment cmt"># Left, so they specified two arguments. First is probably a constant, so let's find that!</span>
37
- <span class="ruby-keyword kw">else</span>
38
- <span class="ruby-identifier">o</span> = <span class="ruby-identifier">find_method</span>(<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">last</span>, <span class="ruby-identifier">first</span>)
39
- <span class="ruby-keyword kw">end</span>
40
- <span class="ruby-identifier">o</span>
41
- <span class="ruby-keyword kw">end</span>
42
-
43
- <span class="ruby-identifier">output</span> = <span class="ruby-identifier">search</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:splitter</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;.&quot;</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">output</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">splitter</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;.&quot;</span>
44
-
45
- <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:api</span>] <span class="ruby-operator">||=</span> [<span class="ruby-value str">&quot;Ruby 1.8.7&quot;</span>, <span class="ruby-value str">&quot;Rails&quot;</span>]
46
- <span class="ruby-identifier">selected_output</span> = <span class="ruby-identifier">output</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:api</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">api</span>.<span class="ruby-identifier">name</span>) }
47
- <span class="ruby-identifier">selected_output</span> = <span class="ruby-identifier">output</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">selected_output</span>.<span class="ruby-identifier">empty?</span>
48
-
49
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">selected_output</span>
50
- <span class="ruby-keyword kw">end</span></pre>
51
- </body>
52
- </html>
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>update_methods! (APILookup::Api)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/models.rb, line 25</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_methods!</span>
15
- <span class="ruby-identifier">entries</span> = []
16
- <span class="ruby-identifier">constants</span> = []
17
- <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;#{url}/fr_method_index.html&quot;</span>))
18
-
19
- <span class="ruby-comment cmt"># Actual HTML on Ruby doc site is invalid. </span>
20
- <span class="ruby-comment cmt"># This makes it valid.</span>
21
- <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">HTML</span>(<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&lt;a(.*?)&gt;(.*?)&lt;\/a&gt;/</span>) { <span class="ruby-node">&quot;&lt;a#{$1}&gt;#{$2.gsub(&quot;&lt;&quot;, &quot;&amp;lt;&quot;).gsub(&quot;&amp;gt;&quot;, &quot;&gt;&quot;)}&quot;</span> })
22
- <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">css</span>(<span class="ruby-value str">&quot;a&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
23
- <span class="ruby-identifier">names</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot; &quot;</span>)
24
- <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">names</span>.<span class="ruby-identifier">empty?</span>
25
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">names</span>[<span class="ruby-value">0</span>]
26
- <span class="ruby-identifier">constant</span> = <span class="ruby-identifier">names</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[\(|\)]/</span>, <span class="ruby-value str">&quot;&quot;</span>)
27
- <span class="ruby-comment cmt"># The same constant can be defined twice in different APIs, be wary!</span>
28
- <span class="ruby-identifier">url</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">url</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/classes/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">constant</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;::&quot;</span>, <span class="ruby-value str">&quot;/&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;.html&quot;</span>
29
- <span class="ruby-identifier">constant</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">find_or_create_by_hash</span>(<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">constant</span>, <span class="ruby-identifier">:url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">url</span>)
30
-
31
- <span class="ruby-identifier">url</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">url</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">a</span>[<span class="ruby-value str">&quot;href&quot;</span>]
32
- <span class="ruby-identifier">constant</span>.<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">find_or_create_by_hash</span>(<span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">method</span>, <span class="ruby-identifier">:url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">url</span>)
33
- <span class="ruby-keyword kw">end</span>
34
-
35
- <span class="ruby-comment cmt"># entries.each_slice(100) do |methods|</span>
36
- <span class="ruby-comment cmt"># LookupBase.connection.execute(&quot;INSERT INTO entries (name, url) &quot;)</span>
37
- <span class="ruby-comment cmt"># end</span>
38
- <span class="ruby-keyword kw">end</span></pre>
39
- </body>
40
- </html>
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>update_classes! (APILookup::Api)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/models.rb, line 51</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_classes!</span>
15
- <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">HTML</span>(<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;#{url}/fr_class_index.html&quot;</span>)))
16
- <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">css</span>(<span class="ruby-value str">&quot;a&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
17
- <span class="ruby-identifier">constant</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">find_or_create_by_name_and_url</span>(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">text</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">url</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">a</span>[<span class="ruby-value str">&quot;href&quot;</span>])
18
- <span class="ruby-keyword kw">end</span>
19
- <span class="ruby-keyword kw">end</span></pre>
20
- </body>
21
- </html>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>connection (SetupTables)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/models.rb, line 75</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">connection</span>
15
- <span class="ruby-constant">APILookup</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">connection</span>
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,34 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html>
7
- <head>
8
- <title>up (SetupTables)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/models.rb, line 79</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">up</span>
15
- <span class="ruby-identifier">create_table</span> <span class="ruby-identifier">:apis</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
16
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">string</span> <span class="ruby-identifier">:name</span>, <span class="ruby-identifier">:url</span>
17
- <span class="ruby-keyword kw">end</span>
18
-
19
- <span class="ruby-identifier">create_table</span> <span class="ruby-identifier">:entries</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
20
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">string</span> <span class="ruby-identifier">:name</span>, <span class="ruby-identifier">:url</span>
21
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">references</span> <span class="ruby-identifier">:constant</span>
22
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">integer</span> <span class="ruby-identifier">:weighting</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
23
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">integer</span> <span class="ruby-identifier">:count</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
24
- <span class="ruby-keyword kw">end</span>
25
-
26
- <span class="ruby-identifier">create_table</span> <span class="ruby-identifier">:constants</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
27
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">string</span> <span class="ruby-identifier">:name</span>, <span class="ruby-identifier">:url</span>
28
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">references</span> <span class="ruby-identifier">:api</span>
29
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">integer</span> <span class="ruby-identifier">:weighting</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
30
- <span class="ruby-identifier">t</span>.<span class="ruby-identifier">integer</span> <span class="ruby-identifier">:count</span>, <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
31
- <span class="ruby-keyword kw">end</span>
32
- <span class="ruby-keyword kw">end</span></pre>
33
- </body>
34
- </html>
@@ -1,112 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: lookup.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>lookup.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/lookup.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Sun Jul 04 09:34:49 +1000 2010</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- rubygems&nbsp;&nbsp;
77
- net/http&nbsp;&nbsp;
78
- active_record&nbsp;&nbsp;
79
- nokogiri&nbsp;&nbsp;
80
- find_by_hash&nbsp;&nbsp;
81
- </div>
82
- </div>
83
-
84
- </div>
85
-
86
-
87
- </div>
88
-
89
-
90
- <!-- if includes -->
91
-
92
- <div id="section">
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <!-- if method_list -->
102
-
103
-
104
- </div>
105
-
106
-
107
- <div id="validator-badges">
108
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
109
- </div>
110
-
111
- </body>
112
- </html>
File without changes
@@ -1,208 +0,0 @@
1
-
2
- body {
3
- font-family: Verdana,Arial,Helvetica,sans-serif;
4
- font-size: 90%;
5
- margin: 0;
6
- margin-left: 40px;
7
- padding: 0;
8
- background: white;
9
- }
10
-
11
- h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
- h1 { font-size: 150%; }
13
- h2,h3,h4 { margin-top: 1em; }
14
-
15
- a { background: #eef; color: #039; text-decoration: none; }
16
- a:hover { background: #039; color: #eef; }
17
-
18
- /* Override the base stylesheet's Anchor inside a table cell */
19
- td > a {
20
- background: transparent;
21
- color: #039;
22
- text-decoration: none;
23
- }
24
-
25
- /* and inside a section title */
26
- .section-title > a {
27
- background: transparent;
28
- color: #eee;
29
- text-decoration: none;
30
- }
31
-
32
- /* === Structural elements =================================== */
33
-
34
- div#index {
35
- margin: 0;
36
- margin-left: -40px;
37
- padding: 0;
38
- font-size: 90%;
39
- }
40
-
41
-
42
- div#index a {
43
- margin-left: 0.7em;
44
- }
45
-
46
- div#index .section-bar {
47
- margin-left: 0px;
48
- padding-left: 0.7em;
49
- background: #ccc;
50
- font-size: small;
51
- }
52
-
53
-
54
- div#classHeader, div#fileHeader {
55
- width: auto;
56
- color: white;
57
- padding: 0.5em 1.5em 0.5em 1.5em;
58
- margin: 0;
59
- margin-left: -40px;
60
- border-bottom: 3px solid #006;
61
- }
62
-
63
- div#classHeader a, div#fileHeader a {
64
- background: inherit;
65
- color: white;
66
- }
67
-
68
- div#classHeader td, div#fileHeader td {
69
- background: inherit;
70
- color: white;
71
- }
72
-
73
-
74
- div#fileHeader {
75
- background: #057;
76
- }
77
-
78
- div#classHeader {
79
- background: #048;
80
- }
81
-
82
-
83
- .class-name-in-header {
84
- font-size: 180%;
85
- font-weight: bold;
86
- }
87
-
88
-
89
- div#bodyContent {
90
- padding: 0 1.5em 0 1.5em;
91
- }
92
-
93
- div#description {
94
- padding: 0.5em 1.5em;
95
- background: #efefef;
96
- border: 1px dotted #999;
97
- }
98
-
99
- div#description h1,h2,h3,h4,h5,h6 {
100
- color: #125;;
101
- background: transparent;
102
- }
103
-
104
- div#validator-badges {
105
- text-align: center;
106
- }
107
- div#validator-badges img { border: 0; }
108
-
109
- div#copyright {
110
- color: #333;
111
- background: #efefef;
112
- font: 0.75em sans-serif;
113
- margin-top: 5em;
114
- margin-bottom: 0;
115
- padding: 0.5em 2em;
116
- }
117
-
118
-
119
- /* === Classes =================================== */
120
-
121
- table.header-table {
122
- color: white;
123
- font-size: small;
124
- }
125
-
126
- .type-note {
127
- font-size: small;
128
- color: #DEDEDE;
129
- }
130
-
131
- .xxsection-bar {
132
- background: #eee;
133
- color: #333;
134
- padding: 3px;
135
- }
136
-
137
- .section-bar {
138
- color: #333;
139
- border-bottom: 1px solid #999;
140
- margin-left: -20px;
141
- }
142
-
143
-
144
- .section-title {
145
- background: #79a;
146
- color: #eee;
147
- padding: 3px;
148
- margin-top: 2em;
149
- margin-left: -30px;
150
- border: 1px solid #999;
151
- }
152
-
153
- .top-aligned-row { vertical-align: top }
154
- .bottom-aligned-row { vertical-align: bottom }
155
-
156
- /* --- Context section classes ----------------------- */
157
-
158
- .context-row { }
159
- .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
- .context-item-value { font-size: small; color: #448; }
161
- .context-item-desc { color: #333; padding-left: 2em; }
162
-
163
- /* --- Method classes -------------------------- */
164
- .method-detail {
165
- background: #efefef;
166
- padding: 0;
167
- margin-top: 0.5em;
168
- margin-bottom: 1em;
169
- border: 1px dotted #ccc;
170
- }
171
- .method-heading {
172
- color: black;
173
- background: #ccc;
174
- border-bottom: 1px solid #666;
175
- padding: 0.2em 0.5em 0 0.5em;
176
- }
177
- .method-signature { color: black; background: inherit; }
178
- .method-name { font-weight: bold; }
179
- .method-args { font-style: italic; }
180
- .method-description { padding: 0 0.5em 0 0.5em; }
181
-
182
- /* --- Source code sections -------------------- */
183
-
184
- a.source-toggle { font-size: 90%; }
185
- div.method-source-code {
186
- background: #262626;
187
- color: #ffdead;
188
- margin: 1em;
189
- padding: 0.5em;
190
- border: 1px dashed #999;
191
- overflow: hidden;
192
- }
193
-
194
- div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
-
196
- /* --- Ruby keyword styles --------------------- */
197
-
198
- .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
-
200
- .ruby-constant { color: #7fffd4; background: transparent; }
201
- .ruby-keyword { color: #00ffff; background: transparent; }
202
- .ruby-ivar { color: #eedd82; background: transparent; }
203
- .ruby-operator { color: #00ffee; background: transparent; }
204
- .ruby-identifier { color: #ffdead; background: transparent; }
205
- .ruby-node { color: #ffa07a; background: transparent; }
206
- .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
- .ruby-regexp { color: #ffa07a; background: transparent; }
208
- .ruby-value { color: #7fffd4; background: transparent; }