sruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 84dd5f9e3cb31dee2f5f1d68c6d931bf5fd6028d8a1b66d40cab5874e5a05a02
4
+ data.tar.gz: 36b7a3af010ce03a3c292aff550f3eff2e48f3f57b21d2a7c979d9f42de2a629
5
+ SHA512:
6
+ metadata.gz: 87f9baa49c2be0c158a400c5e4ab0b1aeb9ccb426b0a9cb2a092c0e5b507fc19947b125af382f10e26fbb5967ca49cc99227c7ab28cab0c82ace5c89fdf2ee45
7
+ data.tar.gz: e53c52b1b7c687dc19c2d4c9897ad555b99d1f0fb84010791d73bc97a4ea11736e310240c68d02ec0c7c7662b0deb3125f5a9d7c42dd4afaa08bb71f4a59b5a9
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/discord.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="DiscordProjectSettings">
4
+ <option name="show" value="PROJECT_FILES" />
5
+ <option name="description" value="" />
6
+ </component>
7
+ </project>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-3.0.3-p157" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/sruby.iml" filepath="$PROJECT_DIR$/.idea/sruby.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/sruby.iml ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.4, ruby-3.0.3-p157) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, ruby-3.0.3-p157) [gem]" level="application" />
16
+ </component>
17
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rubocop.yml ADDED
@@ -0,0 +1,44 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 200
14
+
15
+ Style/HashSyntax:
16
+ Enabled: true
17
+ EnforcedStyle: hash_rockets
18
+
19
+ Layout/EndOfLine:
20
+ Enabled: false
21
+
22
+ Metrics/ModuleLength:
23
+ Enabled: false
24
+
25
+ Metrics/MethodLength:
26
+ Enabled: false
27
+
28
+ Lint/RedundantStringCoercion:
29
+ Enabled: false
30
+
31
+ Style/Documentation:
32
+ Enabled: false
33
+
34
+ Metrics/PerceivedComplexity:
35
+ Enabled: false
36
+
37
+ Metrics/AbcSize:
38
+ Enabled: false
39
+
40
+ Metrics/CyclomaticComplexity:
41
+ Enabled: false
42
+
43
+ Metrics/BlockLength:
44
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-03-13
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in sruby.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "sqlite", "~> 1.0", ">= 1.0.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,21 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sruby (0.1.0)
5
+ sqlite3
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rake (13.0.6)
11
+ sqlite3 (1.4.2)
12
+
13
+ PLATFORMS
14
+ x86_64-linux
15
+
16
+ DEPENDENCIES
17
+ rake (~> 13.0)
18
+ sruby!
19
+
20
+ BUNDLED WITH
21
+ 2.3.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Sruby
2
+
3
+ Sruby is a Ruby Library for easy SQLite interactions. It is a wrapper around the SQLite3 Ruby library.
4
+ Use it to create, read, update, and delete data from SQLite databases without write any query.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'sruby'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install sruby
21
+
22
+ ## Usage
23
+
24
+ To use the librairy, you need to create a database:
25
+
26
+ ```rb
27
+ db = Sruby::Database.new('my_database.db')
28
+ ```
29
+
30
+ Then you can create a table:
31
+ ```rb
32
+ db.create('my_table')
33
+ ```
34
+
35
+ Table creation creates a new getter callable from `db.my_table`, which returns a `Sruby::Table` object.
36
+ To manage data you can use the `insert` or`update` methods.
37
+ You can get get the data with the `get` and `all` methods.
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/sruby/blob/master/CODE_OF_CONDUCT.md).
48
+
49
+ ## License
50
+
51
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
52
+
53
+ ## Code of Conduct
54
+
55
+ Everyone interacting in the Sruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/sruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task :default => %i[]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "sruby"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sruby
4
+ class SrubyError < StandardError
5
+ def initialize(msg = String.new)
6
+ super("SRUBY ERROR : #{msg}")
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,186 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sqlite3"
4
+ require File.expand_path("mixin.rb", __dir__)
5
+ require File.expand_path("errors.rb", __dir__)
6
+
7
+ module Sruby
8
+ class Database
9
+ attr_reader :db
10
+
11
+ # Creates a new database object
12
+ # @param [String, Hash, Sqlite3::Database] options The database file to open, or a hash of options
13
+ def initialize(options = Hash[:name => "sruby.db"])
14
+ case options
15
+ when String
16
+ @db = SQLite3::Database.new(options)
17
+ when Hash
18
+ @db = SQLite3::Database.new(options[:name])
19
+ when SQLite3::Database
20
+ @db = options
21
+ else
22
+ raise SrubyError, "Invalid argument: #{options.inspect}"
23
+ end
24
+ @db.results_as_hash = true if options.is_a?(Hash) && options[:results_as_hash]
25
+ end
26
+
27
+ # Creates a new Table in database
28
+ # @param [String] table_name The name of the table
29
+ # @example
30
+ # db = Sruby::Database.new
31
+ # db.create_table("users")
32
+ # @return [Table] The database object
33
+ def create(table_name)
34
+ @db.execute <<~SQL
35
+ CREATE TABLE IF NOT EXISTS #{table_name} (
36
+ name TEXT PRIMARY KEY,
37
+ value TEXT
38
+ );
39
+ SQL
40
+
41
+ Database.attr_accessor table_name
42
+ instance_variable_set("@#{table_name}", Table.new(@db, table_name))
43
+ instance_variable_get("@#{table_name}")
44
+ end
45
+
46
+ # Insert values into a table
47
+ # @param [String] table_name The name of the table
48
+ # @param [String, Hash] values The values to insert
49
+ # @example
50
+ # db = Sruby::Database.new
51
+ # db.create_table("users")
52
+ # db.insert("users", "person" => "John", "age" => "24")
53
+ # db.insert("users", Hash["person" => "John", "age" => "24"])
54
+ # db.insert("users", "person", "John")
55
+ # @return [Array] The database object
56
+ def insert(table_name, *values)
57
+ case values[0]
58
+ when Hash
59
+ values[0].stringify_keys!
60
+ values_as_paths = values[0].paths
61
+ values_as_paths.each do |path, value|
62
+ p path, value
63
+ @db.execute("INSERT INTO #{table_name} (name, value) VALUES (?, ?)", path.join("."), value)
64
+ end
65
+ else
66
+ @db.execute("INSERT INTO #{table_name} (name, value) VALUES (?, ?)", values[0].to_s, values[1])
67
+ end
68
+ rescue SQLite3::ConstraintException
69
+ raise SrubyError, "Duplicated key"
70
+ end
71
+
72
+ # Updates values in a table
73
+ # @param [String] table_name The name of the table
74
+ # @param [String, Hash] values The values to update
75
+ # @example
76
+ # db = Sruby::Database.new
77
+ # db.create_table("users")
78
+ # db.insert("users", "person" => "John", "age" => "24")
79
+ # db.update("users", "person" => "John", "age" => "25")
80
+ # db.update("users", Hash["person" => "John", "age" => "25"])
81
+ # @return [Array] The database object
82
+ def update(table_name, *values)
83
+ case values[0]
84
+ when Hash
85
+ values[0].stringify_keys!
86
+ values_as_paths = values[0].paths
87
+ values_as_paths.each do |path, value|
88
+ p path, value
89
+ @db.execute("REPLACE INTO #{table_name} (name, value) VALUES (?, ?)", path.join("."), value)
90
+ end
91
+ else
92
+ @db.execute("REPLACE INTO #{table_name} (name, value) VALUES (?, ?)", values[0].to_s, values[1])
93
+ end
94
+ end
95
+
96
+ # Get a value from a table
97
+ # @param [String] table_name The name of the table
98
+ # @param [String] name The value to get
99
+ # @param [Nil, String] path The path to get
100
+ # @example
101
+ # db = Sruby::Database.new
102
+ # db.create_table("users")
103
+ # db.insert("users", "person" => "John", "age" => "24")
104
+ # db.get("users", "person")
105
+ # @return [String] The value
106
+ def get(table_name, name, path = nil)
107
+ if path.nil?
108
+ @db.execute("SELECT value FROM #{table_name} WHERE name = ?", name)
109
+ else
110
+ path_name = case path
111
+ when Array
112
+ "#{path.map(&:to_s).join(".")}.#{name}"
113
+ when String
114
+ "#{path}.#{name}"
115
+ else
116
+ name
117
+ end
118
+ data = @db.execute("SELECT value FROM #{table_name} WHERE name = ?", path_name)
119
+ raise SrubyError, "No value found for #{path_name}" if data.empty?
120
+ data
121
+ end
122
+ end
123
+
124
+ # Deletes a row from a table
125
+ # @param [String] table_name The name of the table
126
+ # @param [String] name The name of the row to delete
127
+ # @param [Nil, String] path The path to delete
128
+ # @example
129
+ # db = Sruby::Database.new
130
+ # db.create_table("users")
131
+ # db.insert("users", "person" => "John", "age" => "24")
132
+ # db.delete("users", "person")
133
+ # @return [Array] The database object
134
+ def delete(table_name, name, path = nil)
135
+ if path.nil?
136
+ @db.execute("DELETE FROM #{table_name} WHERE name = ?", name)
137
+ else
138
+ path_name = case path
139
+ when Array
140
+ "#{path.map(&:to_s).join(".")}.#{name}"
141
+ when String
142
+ "#{path}.#{name}"
143
+ else
144
+ name
145
+ end
146
+ @db.execute("DELETE FROM #{table_name} WHERE name = ?", path_name)
147
+ end
148
+ end
149
+
150
+ # Get all the values from a table
151
+ # @param [String] table_name The name of the table
152
+ # @return [Array] The values
153
+ def all(table_name)
154
+ @db.execute("SELECT * FROM #{table_name}")
155
+ end
156
+ end
157
+
158
+ class Table
159
+ attr_reader :db, :name
160
+
161
+ def initialize(db, name)
162
+ @db = db
163
+ @name = name
164
+ end
165
+
166
+ def insert(*values)
167
+ Database.new(@db).insert(@name, *values)
168
+ end
169
+
170
+ def update(*values)
171
+ Database.new(@db).update(@name, *values)
172
+ end
173
+
174
+ def get(name, path = nil)
175
+ Database.new(@db).get(@name, name, path)
176
+ end
177
+
178
+ def delete(name, path = nil)
179
+ Database.new(@db).delete(@name, name, path)
180
+ end
181
+
182
+ def all
183
+ Database.new(@db).all(@name)
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Hash
4
+ def stringify_keys!
5
+ transform_keys!(&:to_s)
6
+ end
7
+
8
+ def stringify_values!
9
+ transform_values!(&:to_s)
10
+ end
11
+
12
+ # Get the deepest keys
13
+ # @param hash [Hash] the hash to get the deepest keys from
14
+ # @return [Array<String>] the deepest keys
15
+ def keys(hash = self)
16
+ hash.each_with_object([]) do |(key, value), paths|
17
+ if value.is_a?(Hash)
18
+ paths.concat(keys(value))
19
+ else
20
+ paths << key
21
+ end
22
+ end
23
+ end
24
+
25
+ # Get the deep path of a certain key
26
+ # @param key [String] the key to get the path for
27
+ # @param path [Array] the current path
28
+ # @return [NilClass, Array<String, String>] the path to the key
29
+ def path_to(key, path = [], hash: self)
30
+ hash.stringify_keys!
31
+ hash.each_pair do |k, v|
32
+ return [path + [k], v] if k == key.to_s
33
+ if v.is_a?(Hash) &&
34
+ (p = path_to(key.to_s, path + [k], :hash => v))
35
+ return p
36
+ end
37
+ end
38
+ nil
39
+ end
40
+
41
+ def paths(hash = self)
42
+ keys(hash).map { |key| path_to(key, :hash => hash) }
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sruby
4
+ VERSION = "0.1.0"
5
+ end
data/lib/sruby.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "sruby/version"
4
+
5
+ module Sruby
6
+ end
@@ -0,0 +1,5 @@
1
+ module Sruby
2
+ class Database
3
+
4
+ end
5
+ end
data/sig/sruby.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Sruby
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/tests/index.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../lib/sruby/index"
4
+
5
+ db = Sruby::Database.new
6
+ test = db.create("test")
7
+ db.test == test
8
+ test.insert("one" => 1)
9
+ test.insert("member" => Hash[:name=>"John", :age=>25])
10
+ test.delete("one")
11
+ test.all
12
+ db.all("test")
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Senchu
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sqlite3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: The Sruby library allows you to create, read, update an delete data from
28
+ SQlite database without using any SQL query. It's useful and fast for small and
29
+ medium size database.
30
+ email:
31
+ - senchuuuu@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".idea/.gitignore"
37
+ - ".idea/discord.xml"
38
+ - ".idea/misc.xml"
39
+ - ".idea/modules.xml"
40
+ - ".idea/sruby.iml"
41
+ - ".idea/vcs.xml"
42
+ - ".rubocop.yml"
43
+ - CHANGELOG.md
44
+ - CODE_OF_CONDUCT.md
45
+ - Gemfile
46
+ - Gemfile.lock
47
+ - LICENSE.txt
48
+ - README.md
49
+ - Rakefile
50
+ - bin/console
51
+ - bin/setup
52
+ - lib/sruby.rb
53
+ - lib/sruby/errors.rb
54
+ - lib/sruby/index.rb
55
+ - lib/sruby/mixin.rb
56
+ - lib/sruby/version.rb
57
+ - sig/sruby.rbs
58
+ - sig/sruby/index.rbs
59
+ - tests/index.rb
60
+ homepage: https://github.com/Senchuu/Sruby
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ allowed_push_host: https://rubygems.org
65
+ homepage_uri: https://github.com/Senchuu/Sruby
66
+ source_code_uri: https://github.com/Senchuu/Sruby
67
+ changelog_uri: https://github.com/Senchuu/Sruby/blob/main/CHANGELOG.md
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 2.6.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 3.3.4
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Create, read, update and delete data from SQLite database.
87
+ test_files: []