myCal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/README.md +29 -0
- data/Rakefile +4 -0
- data/lib/myCal/version.rb +5 -0
- data/lib/myCal.rb +37 -0
- data/myCal.gemspec +38 -0
- data/sig/myCal.rbs +4 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad6e80210976f371326191a9f2f2457198ef75245236ff84afbb73fa2a4fc178
|
4
|
+
data.tar.gz: 5d346461a1ad2509fdb5d6ea2b6b35b9da41f0eb41d454b0ca12d453beb984ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c125c11cd09e9447ba3e2c6438e4a1a10da0f831f633bb833f2745ed4095456cb14bf812bdbfa3652ac0577354a1a560afd4c24ba62cd509e805095e57b74cd6
|
7
|
+
data.tar.gz: fd0c018e997e490a76e5c8ea2b5224a0d37912ad871f46cba7e33fdcf4276f44dec0740f7b6473327db5bf34f2582fc8b9e5a0aaad57b807ebb014f58a986528
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# MyCal
|
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/myCal`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add myCal
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install myCal
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
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).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/myCal.
|
data/Rakefile
ADDED
data/lib/myCal.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# My simple calculator with gem
|
4
|
+
|
5
|
+
require_relative "myCal/version"
|
6
|
+
|
7
|
+
module MyCal
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
# define add function
|
11
|
+
def self.add(n1, n2)
|
12
|
+
return n1+n2 # return result of addition
|
13
|
+
end ## end of function
|
14
|
+
|
15
|
+
# define sub function
|
16
|
+
def self.sub(n1, n2)
|
17
|
+
return n1-n2 # return result of suntraction
|
18
|
+
end ## end of function
|
19
|
+
|
20
|
+
# define mtp function
|
21
|
+
def self.mtp(n1, n2)
|
22
|
+
return n1*n2 # return result of multiplication
|
23
|
+
end ## end of function
|
24
|
+
|
25
|
+
# define div function
|
26
|
+
def self.div(n1, n2)
|
27
|
+
n1 = n1.to_f # convert number to flaot
|
28
|
+
n2 = n2.to_f # convert number to flaot
|
29
|
+
if n2 == 0 ## check n2 is equal to zero or not
|
30
|
+
return "Divisor can't be zero!"
|
31
|
+
else
|
32
|
+
return (n1/n2)# return result of division
|
33
|
+
end ## end of if
|
34
|
+
|
35
|
+
end ## end of function
|
36
|
+
|
37
|
+
end
|
data/myCal.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/myCal/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "myCal"
|
7
|
+
spec.version = MyCal::VERSION
|
8
|
+
spec.authors = ["jiashun-nci"]
|
9
|
+
spec.email = ["73401615+jiashun-nci@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "Simple Calculator"
|
12
|
+
spec.description = "Simple Calculator with add feature"
|
13
|
+
spec.homepage = "https://rubygems.org/Jiashun"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://rubygems.org/Jiashun"
|
20
|
+
spec.metadata["changelog_uri"] = "https://rubygems.org/Jiashun"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, check out our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
end
|
data/sig/myCal.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: myCal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jiashun-nci
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Simple Calculator with add feature
|
14
|
+
email:
|
15
|
+
- 73401615+jiashun-nci@users.noreply.github.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- README.md
|
22
|
+
- Rakefile
|
23
|
+
- lib/myCal.rb
|
24
|
+
- lib/myCal/version.rb
|
25
|
+
- myCal.gemspec
|
26
|
+
- sig/myCal.rbs
|
27
|
+
homepage: https://rubygems.org/Jiashun
|
28
|
+
licenses: []
|
29
|
+
metadata:
|
30
|
+
allowed_push_host: https://rubygems.org
|
31
|
+
homepage_uri: https://rubygems.org/Jiashun
|
32
|
+
source_code_uri: https://rubygems.org/Jiashun
|
33
|
+
changelog_uri: https://rubygems.org/Jiashun
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.6.0
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubygems_version: 3.3.23
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Simple Calculator
|
53
|
+
test_files: []
|