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.
- 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: 8e9fb4f3c3047f216509d2388ed16491e86bbf326cb637a7f3289139e644b8b1
|
4
|
+
data.tar.gz: 85f44def79d35aceaea9e47d6254aec242d7c11d19ca66533b661d5e0f9e6de9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6df874a78c41d1d3b1e81a9ae22ea4c7b1e0d493a15e0be4705b2d3a052d1962bff3bba5cdd3e337638c066671d16242110071d7df91bdf4ae2c2a8aea993837
|
7
|
+
data.tar.gz: 1c893173ade69ff01785f5035dfb72c0461f8998451e430de57fd18626954585d5be02a7ea6822bbe8f8bbcb2f8f530ffb60413c368296087fe37bbfd88bc58f
|
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.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-
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prism
|