import_rb 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -9
  3. data/lib/import_rb/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c497ef057f0fdb7bd018cb11f52f6ba8ecc4fbb403469179846998a6f3300af1
4
- data.tar.gz: 2c3155db01d88bf05f59f0bee7200f002423ab9bd47070e109893c3827cf49af
3
+ metadata.gz: 8e9fb4f3c3047f216509d2388ed16491e86bbf326cb637a7f3289139e644b8b1
4
+ data.tar.gz: 85f44def79d35aceaea9e47d6254aec242d7c11d19ca66533b661d5e0f9e6de9
5
5
  SHA512:
6
- metadata.gz: 65884b3e38b88e83e2d6f28f846dc61969072ae9b4d8d50447e7c317b8aba7473f866ee633931a5566c84971bb278b641381a2f01dc9de6becf2c0bd37fc9d90
7
- data.tar.gz: e1abc83a78cf2e96b1a2b6681497b74748ece237ae27645a97db3bc8f67ffcde8ed804392dad2df620d404c76bdde9da63fee28e4eb3e23409fe65090cc3bfb9
6
+ metadata.gz: 6df874a78c41d1d3b1e81a9ae22ea4c7b1e0d493a15e0be4705b2d3a052d1962bff3bba5cdd3e337638c066671d16242110071d7df91bdf4ae2c2a8aea993837
7
+ data.tar.gz: 1c893173ade69ff01785f5035dfb72c0461f8998451e430de57fd18626954585d5be02a7ea6822bbe8f8bbcb2f8f530ffb60413c368296087fe37bbfd88bc58f
data/README.md CHANGED
@@ -1,24 +1,53 @@
1
1
  # ImportRb
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- 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/import_rb`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Gem to experiment with namespace on read semantics.
6
4
 
7
5
  ## Installation
8
6
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
7
  Install the gem and add to the application's Gemfile by executing:
12
8
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
9
+ $ bundle add import_rb
14
10
 
15
11
  If bundler is not being used to manage dependencies, install the gem by executing:
16
12
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ $ gem install import_rb
18
14
 
19
15
  ## Usage
20
16
 
21
- TODO: Write usage instructions here
17
+ Consider this file `sample.rb`:
18
+
19
+ ```ruby
20
+ class Alpha
21
+ def speak = "alpha hath spoken"
22
+ end
23
+
24
+ class Beta
25
+ def speak = "beta hath spoken"
26
+ end
27
+
28
+ class Gamma
29
+ def speak = "gamma hath spoken"
30
+ end
31
+ ```
32
+
33
+ You can import specific constants from a file into your file:
34
+ ```ruby
35
+ import [:Alpha, :Beta], from: 'spec/fixtures/sample.rb'
36
+ ```
37
+
38
+ You can import into the global namespace or into another constant:
39
+ ```ruby
40
+ class SomeClass; end
41
+ module SomeModule; end
42
+
43
+ SomeClass.import [:Alpha, :Beta], from: 'sample.rb'
44
+ SomeModule.import [:Alpha, :Beta], from: 'sample.rb'
45
+ ```
46
+
47
+ You can also import a constant and give it another name:
48
+ ```ruby
49
+ import [:Alpha.as(:Alif), :Beta], from: 'spec/fixtures/sample.rb'
50
+ ```
22
51
 
23
52
  ## Development
24
53
 
@@ -28,7 +57,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
28
57
 
29
58
  ## Contributing
30
59
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/import_rb. 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]/import_rb/blob/main/CODE_OF_CONDUCT.md).
60
+ Bug reports and pull requests are welcome on GitHub at https://github.com/faraazahmad/import_rb. 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/faraazahmad/import_rb/blob/main/CODE_OF_CONDUCT.md).
32
61
 
33
62
  ## License
34
63
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImportRb
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: import_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Syed Faraaz Ahmad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-16 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prism