import_rb 0.1.1 → 0.1.2

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: 0b636817a15f5d10c2aa96a9269684d7ae3a6ae373a2f05934b4157e7899e86c
4
+ data.tar.gz: fa3ecdda644931b67d0a1cc25b713df720fd9b388d146c73ebd0ee867077f0b2
5
5
  SHA512:
6
- metadata.gz: 65884b3e38b88e83e2d6f28f846dc61969072ae9b4d8d50447e7c317b8aba7473f866ee633931a5566c84971bb278b641381a2f01dc9de6becf2c0bd37fc9d90
7
- data.tar.gz: e1abc83a78cf2e96b1a2b6681497b74748ece237ae27645a97db3bc8f67ffcde8ed804392dad2df620d404c76bdde9da63fee28e4eb3e23409fe65090cc3bfb9
6
+ metadata.gz: 892b121a91af654d88b15c361016d585bd7ca18a7c3adbe0acf0a82e2b58c3c303cd4af1b21eb0754e9c3a209a945346bbab51cd35b2b0320a37e9cf84073459
7
+ data.tar.gz: 0bc18044621cd8ade0c3343023f48a9541ee05fe22edde238fad59d44d850ac35e78dc16ba25e5b3118f4416577151de7431e556ad73d444028a079c7a0c2f9b
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.2"
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.2
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