pdground 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cd895af8d029eb4843845f292fe3b0a3819e1af7
4
- data.tar.gz: 1c1fd6b8cc25cac891389a39de37e3dc9b197cd0
2
+ SHA256:
3
+ metadata.gz: 4779c2e90e8d9f8f97a04d8b9f9b9569fba66365b8dbf712a916295525ba1fc8
4
+ data.tar.gz: 5d80c20d2c1ef02a3b8f283b71633cab97b6b631beb0d6fb67ff596ddab125ac
5
5
  SHA512:
6
- metadata.gz: ca96d67a7f6333a4348ecf4a2dccc4a02096af9c0d7aaf7b72d18ef21419b87396b82c93e0d9a95a9d3295053fd4c373ad94d3fbf2fc15067c39c6d3cd099ee4
7
- data.tar.gz: 54e22bc131abd8f110f6f9cd585e431a826ad3f5f858fbc697c47040b024a3aea3750cc621d2d7a01ac2bbf0f8e2af25f53d25bf8b7bb07eeecaee993354c2b2
6
+ metadata.gz: 7de4fec18be40763560de18d8ea741b194d70ca1b79054530ab427ed9c9b1db2ee87240cb22ec0d83d374647257976dcffb1d1f4d929ff5c8821dcb1393efaa0
7
+ data.tar.gz: 34b3b0da627f6b8d9e2505afb514e1987cde4d187d03fd90303e6c5ed7488177a96828174346833baf373f37aa951aa29dfb824717996418e4a75af326faf1d7
data/.gitlab-ci.yml CHANGED
@@ -30,5 +30,6 @@ rubygems:
30
30
  name: rubygems
31
31
  url: https://rubygems.org/gems/pdground
32
32
  script:
33
+ - gem build pdground.gemspec
33
34
  - gem install dpl
34
35
  - dpl --provider=rubygems --api-key=$RUBYGEMS_KEY
data/.rubocop.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  Metrics/AbcSize:
2
- Max: 20
2
+ Max: 20
3
+ AllCops:
4
+ TargetRubyVersion: 2.4
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Pdground
2
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/pdground`. 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
3
+ PDGRound allows you to round a number with an uncertainty using the PDG rounding rules.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,22 +20,34 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ Pdground provides an easy to use function to round a given number with an uncertainty using the PDG rules. The rule [states the following](http://pdg.lbl.gov/2010/reviews/rpp2010-rev-rpp-intro.pdf) [Sec 5.3]:
24
+
25
+ > The basic rule states that if the three highest order digits of the error lie between 100 and 354, we round to two significant digits. If they lie between 355 and 949, we round to one significant digit. Finally, if they lie between 950 and 999, we round up to 1000 and keep two significant digits. In all cases, the central value is given with a precision that matches that of the error
26
26
 
27
- ## Development
27
+ For example, given the value `12.2135 +- 0.03215` the rounded value reults in `12.214 +- 0.032` while for the value `12.2135 +- 0.06515` the rounded value reults in `12.21 +- 0.07`.
28
28
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+ Using `Pdground` in your code it is as simple as doing:
30
30
 
31
- 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).
31
+ ```ruby
32
+ require 'pdground'
33
+
34
+ value = 12.2135
35
+ error = 0.06515
36
+ result = Pdground::round(meas: value, unc: error)
37
+ puts "Rounded value: #{result[0]}"
38
+ puts "Rounded error: #{result[1]}"
39
+ # Rounded value: 12.21
40
+ # Rounded error: 0.07
41
+ ```
32
42
 
33
43
  ## Contributing
34
44
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pdground. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
45
+ If you want to contribute to improve this gem with any bug fix or new feature:
46
+ * First open an issue to discuss the bug or feature
47
+ * Place a merge request referring to the issue once agreed to include it
48
+
49
+ Tests **must be added** to ensure maintainability.
36
50
 
37
51
  ## License
38
52
 
39
53
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Pdground project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pdground/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'pdground'
data/exe/pdground CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'pdground'
data/lib/pdground.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pdground/version'
2
4
  require 'pdground/extension'
3
5
  require 'pdground/pdground'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Redefine float with the apropriate options
2
4
  class Float
3
5
  def sigfig(digits)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # PDGRound module
2
4
  module PDGRound
3
5
  # Main function for the rounding
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pdground
2
- VERSION = '0.1.0'.freeze
4
+ VERSION = '0.1.1'
3
5
  end
data/pdground.gemspec CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'pdground/version'
@@ -28,4 +30,6 @@ Gem::Specification.new do |spec|
28
30
  spec.add_development_dependency 'rspec', '~> 3.0'
29
31
  spec.add_development_dependency 'rubocop', '~> 0'
30
32
  spec.add_development_dependency 'simplecov', '~> 0'
33
+
34
+ spec.required_ruby_version = '~> 2.4'
31
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdground
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.P. Araque
@@ -95,7 +95,6 @@ files:
95
95
  - ".gitlab-ci.yml"
96
96
  - ".rspec"
97
97
  - ".rubocop.yml"
98
- - CODE_OF_CONDUCT.md
99
98
  - Gemfile
100
99
  - LICENSE.txt
101
100
  - README.md
@@ -118,9 +117,9 @@ require_paths:
118
117
  - lib
119
118
  required_ruby_version: !ruby/object:Gem::Requirement
120
119
  requirements:
121
- - - ">="
120
+ - - "~>"
122
121
  - !ruby/object:Gem::Version
123
- version: '0'
122
+ version: '2.4'
124
123
  required_rubygems_version: !ruby/object:Gem::Requirement
125
124
  requirements:
126
125
  - - ">="
@@ -128,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
127
  version: '0'
129
128
  requirements: []
130
129
  rubyforge_project:
131
- rubygems_version: 2.6.11
130
+ rubygems_version: 2.7.4
132
131
  signing_key:
133
132
  specification_version: 4
134
133
  summary: Round numbers using the PDGRound rounding rules
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at jp.araque@cern.ch. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/