segments_lexicon 0.0.1 → 0.0.2

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.
@@ -1,6 +1,18 @@
1
+ require 'sqlite3'
1
2
  require "segments_lexicon/version"
2
- require "segments_lexicon/lexicon"
3
3
 
4
- module SegmentsLexicon
5
- # Your code goes here...
4
+ class SegmentsLexicon
5
+ # Opens a connection to the db
6
+ #
7
+ # param sqlite_db_path [String] Path to the sqlite3 db file
8
+ def initialize(sqlite_db_path, table_name)
9
+ @db = SQLite3::Database.new(sqlite_db_path)
10
+ @db.results_as_hash = true
11
+ @table = table_name
12
+ self
13
+ end
14
+
15
+ def search(query_term)
16
+ results = @db.execute "select * from #{@table} WHERE word LIKE \"#{query_term.downcase}\" COLLATE NOCASE"
17
+ end
6
18
  end
@@ -1,3 +1,3 @@
1
- module SegmentsLexicon
2
- VERSION = "0.0.1"
1
+ class SegmentsLexicon
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: segments_lexicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -40,7 +40,6 @@ files:
40
40
  - README.md
41
41
  - Rakefile
42
42
  - lib/segments_lexicon.rb
43
- - lib/segments_lexicon/lexicon.rb
44
43
  - lib/segments_lexicon/version.rb
45
44
  - segments_lexicon.gemspec
46
45
  homepage: ''
@@ -1,19 +0,0 @@
1
- require 'sqlite3'
2
-
3
- class Lexicon
4
-
5
- # Opens a connection to the db
6
- #
7
- # param sqlite_db_path [String] Path to the sqlite3 db file
8
- def initialize(sqlite_db_path, table_name)
9
- @db = SQLite3::Database.new(sqlite_db_path)
10
- @db.results_as_hash = true
11
- @table = table_name
12
- self
13
- end
14
-
15
- def search(query_term)
16
- results = @db.execute "select * from #{@table} WHERE word LIKE \"#{query_term.downcase}\" COLLATE NOCASE"
17
- end
18
-
19
- end