rstd 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1e13b47442ec28dcdaa29a6714f5538170bf73977fce56576d13ed2891c3bdac
4
+ data.tar.gz: cd00230092339cdd5191941c7ed02901423f54289841ca95191f587558969261
5
+ SHA512:
6
+ metadata.gz: 2b43245e6362426de9b084fe2514b18911679d31d918462e4bcc7f99f168de7cadba6e7c60a295f52b8ce9ef07beeed5856ff97beb756efb671fc33c43f1cacc
7
+ data.tar.gz: 7101fefa8e3f4109a9f2b5914b8b2fa84ae47b5a60457d33257c97f60f5308e8245a79c06a162e8109474abf6ddb3ceaaee6e38ec2567d07c434780b665ce39d
@@ -0,0 +1,22 @@
1
+ name: MacOS
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ os: [ macos-latest ]
10
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
11
+ runs-on: ${{ matrix.os }}
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake
@@ -0,0 +1,29 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ version: 2.7
19
+
20
+ - name: Publish to RubyGems
21
+ run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push *.gem
28
+ env:
29
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,22 @@
1
+ name: Ubuntu
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ os: [ ubuntu-16.04, ubuntu-18.04 ]
10
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
11
+ runs-on: ${{ matrix.os }}
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake
@@ -0,0 +1,22 @@
1
+ name: Windows
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ os: [ windows-latest ]
10
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
11
+ runs-on: ${{ matrix.os }}
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,9 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.4
6
+ - 2.5
7
+ - 2.6
8
+ - 2.7
9
+ before_install: gem install bundler
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rstd.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 S.H.
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,32 @@
1
+ # Rstd
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rstd`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rstd'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rstd
20
+
21
+ ## Usage
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rstd.
32
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,27 @@
1
+ version: '{build}-{branch}'
2
+
3
+ platform:
4
+ - x64
5
+
6
+ clone_depth: 5
7
+
8
+ environment:
9
+ matrix:
10
+ - RUBY_VERSION: 24
11
+ - RUBY_VERSION: 25
12
+ - RUBY_VERSION: 26
13
+ - RUBY_VERSION: 27
14
+
15
+ install:
16
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
17
+ - bundle install
18
+
19
+ build: off
20
+
21
+ before_test:
22
+ - ruby -v
23
+ - gem -v
24
+ - bundle -v
25
+
26
+ test_script:
27
+ - bundle exec rake
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rstd"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -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
+ require "rstd/version"
2
+ require "rstd/array"
3
+ require "rstd/string"
4
+ require "rstd/integer"
5
+
6
+ module Rstd
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,35 @@
1
+ module Rstd::RefineArray
2
+ refine Array do
3
+ def first_last(length = 1, reversed: false)
4
+ if reversed
5
+ [self.first(length).reverse, self.last(length).reverse]
6
+ else
7
+ [self.first(length), self.last(length)]
8
+ end
9
+ end
10
+
11
+ def rsum(length = self.length)
12
+ self.last(length).sum
13
+ end
14
+
15
+ def lsum(length = self.length)
16
+ self.first(length).sum
17
+ end
18
+
19
+ def rsort
20
+ self.sort.reverse
21
+ end
22
+
23
+ def to_range
24
+ 0..(self.size - 1)
25
+ end
26
+
27
+ def delete_first(length = 1)
28
+ self - self.first(length)
29
+ end
30
+
31
+ def delete_last(length = 1)
32
+ self - self.last(length)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,15 @@
1
+ module Rstd::RefineInteger
2
+ refine Integer do
3
+ def inc
4
+ self.succ
5
+ end
6
+
7
+ def dec
8
+ self.pred
9
+ end
10
+
11
+ def mod(num)
12
+ self % num
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,55 @@
1
+ module Rstd::RefineString
2
+ refine String do
3
+ def first(pos = 0)
4
+ if pos > 0
5
+ self[0..(pos - 1)]
6
+ elsif pos < 0
7
+ self[0..pos]
8
+ else
9
+ self[0]
10
+ end
11
+ end
12
+
13
+ def last(pos = 0)
14
+ if pos > 0
15
+ pos > self.size ? self[0..-1] : self[-pos..-1]
16
+ elsif pos < 0
17
+ -pos > self.size ? "" : self[0..-(pos + 1)]
18
+ else
19
+ self[-1]
20
+ end
21
+ end
22
+
23
+ def has?(pattern)
24
+ self.include?(pattern)
25
+ end
26
+
27
+ def join(str)
28
+ self + str
29
+ end
30
+
31
+ def first_line
32
+ self.lines.first
33
+ end
34
+
35
+ def last_line
36
+ self.lines.last
37
+ end
38
+
39
+ def has_num?
40
+ self =~ /\d/ ? true : false
41
+ end
42
+
43
+ def delete_first_line
44
+ result = self.lines
45
+ result.shift
46
+ result.join
47
+ end
48
+
49
+ def delete_last_line
50
+ result = self.lines
51
+ result.pop
52
+ result.join
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ module Rstd
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/rstd/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rstd"
5
+ spec.version = Rstd::VERSION
6
+ spec.authors = ["S-H-GAMELINKS"]
7
+ spec.email = ["gamelinks007@gmail.com"]
8
+
9
+ spec.summary = %q{ useful implementation for ruby }
10
+ spec.description = %q{ useful implementation for ruby }
11
+ spec.homepage = "https://github.com/S-H-GAMELINKS/rstd"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "https://github.com/S-H-GAMELINKS/rstd"
16
+ spec.metadata["changelog_uri"] = "https://github.com/S-H-GAMELINKS/rstd"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rstd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - S-H-GAMELINKS
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: " useful implementation for ruby "
14
+ email:
15
+ - gamelinks007@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".github/workflows/macos.yml"
21
+ - ".github/workflows/release.yml"
22
+ - ".github/workflows/ubuntu.yml"
23
+ - ".github/workflows/windows.yml"
24
+ - ".gitignore"
25
+ - ".travis.yml"
26
+ - Gemfile
27
+ - LICENSE
28
+ - README.md
29
+ - Rakefile
30
+ - appveyor.yml
31
+ - bin/console
32
+ - bin/setup
33
+ - lib/rstd.rb
34
+ - lib/rstd/array.rb
35
+ - lib/rstd/integer.rb
36
+ - lib/rstd/string.rb
37
+ - lib/rstd/version.rb
38
+ - rstd.gemspec
39
+ homepage: https://github.com/S-H-GAMELINKS/rstd
40
+ licenses: []
41
+ metadata:
42
+ homepage_uri: https://github.com/S-H-GAMELINKS/rstd
43
+ source_code_uri: https://github.com/S-H-GAMELINKS/rstd
44
+ changelog_uri: https://github.com/S-H-GAMELINKS/rstd
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.1.2
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: useful implementation for ruby
64
+ test_files: []