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.
- checksums.yaml +4 -4
- data/README.md +38 -9
- data/lib/import_rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b636817a15f5d10c2aa96a9269684d7ae3a6ae373a2f05934b4157e7899e86c
|
4
|
+
data.tar.gz: fa3ecdda644931b67d0a1cc25b713df720fd9b388d146c73ebd0ee867077f0b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 892b121a91af654d88b15c361016d585bd7ca18a7c3adbe0acf0a82e2b58c3c303cd4af1b21eb0754e9c3a209a945346bbab51cd35b2b0320a37e9cf84073459
|
7
|
+
data.tar.gz: 0bc18044621cd8ade0c3343023f48a9541ee05fe22edde238fad59d44d850ac35e78dc16ba25e5b3118f4416577151de7431e556ad73d444028a079c7a0c2f9b
|
data/README.md
CHANGED
@@ -1,24 +1,53 @@
|
|
1
1
|
# ImportRb
|
2
2
|
|
3
|
-
|
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
|
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
|
13
|
+
$ gem install import_rb
|
18
14
|
|
19
15
|
## Usage
|
20
16
|
|
21
|
-
|
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/
|
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
|
|
data/lib/import_rb/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prism
|