better_input 0.1.1 → 0.1.3
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 +4 -4
- data/README.md +22 -2
- data/better_input-0.1.1.gem +0 -0
- data/lib/better_input/version.rb +1 -1
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c848df3c63f7e819ef7deeeed05b22094bf132a5da05d45704a1e8cb8decab6
|
4
|
+
data.tar.gz: 9620cd0a13abeb759e1f5b4e0f0df0236577e93df5d6a103611d19b3b5d235d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dac52adbd77cbf7f84b6f613cce8f66853a5ee522e3b06fe308d049396b6fabf70bcb0ff610b33af6252ca4735e730b637615d9dd7c360011f9d2214df1a4f6b
|
7
|
+
data.tar.gz: 9f36861cea2bdbfc1e72ccd0b092d5533794164dfcfa0584e2d8de95faa3f8f0963d0c8330860c4821f5f64e30a5ba8ccfacbfe37bc4afae231e31e6cbf1c2ec
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@ Whenever I tried to make an application that would be based on a command line in
|
|
6
6
|
|
7
7
|
To install this gem just use:
|
8
8
|
|
9
|
-
|
9
|
+
```shell
|
10
|
+
gem install better_input
|
11
|
+
```
|
10
12
|
|
11
13
|
|
12
14
|
## Usage
|
@@ -30,9 +32,27 @@ loop do
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
|
-
puts "
|
35
|
+
puts "User response: #{age}"
|
34
36
|
```
|
35
37
|
Although it requires other approaches like the one I did in the gem. here are some examples of how it works with inputs in ruby using the gem:
|
38
|
+
```ruby
|
39
|
+
require 'better_input'
|
40
|
+
|
41
|
+
age = Bi.input("Digite um número: ", type: "int", show_response: true)
|
42
|
+
# In a single line we asked the question and stored it in a variable,
|
43
|
+
# we made sure it was the type we wanted and we even made the answer appear!
|
44
|
+
```
|
45
|
+
```ruby
|
46
|
+
#Another examples:
|
47
|
+
|
48
|
+
noquestion = Bi.input()
|
49
|
+
retype = Bi.input(show_response: true)
|
50
|
+
onlyfloat = Bi.input(type: float)
|
51
|
+
|
52
|
+
name = Bi.input("What is your name?")
|
53
|
+
puts "Your name is #{name}"
|
54
|
+
```
|
55
|
+
Anyway, use your creativity, now receiving constant user input for CLI has become less laborious!
|
36
56
|
|
37
57
|
## Function before becoming a gem
|
38
58
|
This was more or less the base that I ended up making, I made some small improvements that you can find in the files present in this repository before turning it into a gem.
|
Binary file
|
data/lib/better_input/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_input
|
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
|
- Barros Flavio
|
@@ -10,8 +10,29 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
13
|
+
description: |+
|
14
|
+
This is an improved input function for Ruby.
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
Using this gem, you can easily get user input with real-time type validation, ensuring that the data provided is as expected, among other things.
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
If you have any questions, check the documentation: https://github.com/barrosflavio/ruby_better_input
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Features:
|
27
|
+
|
28
|
+
- Ask, receive and check input in a single line
|
29
|
+
|
30
|
+
- Support for types such as integer, float and boolean.
|
31
|
+
|
32
|
+
- Input validation with clear error messages.
|
33
|
+
|
34
|
+
- Intuitive and easy-to-use function.
|
35
|
+
|
15
36
|
email:
|
16
37
|
- flaviomarbs@gmail.com
|
17
38
|
executables: []
|
@@ -22,6 +43,7 @@ files:
|
|
22
43
|
- README.md
|
23
44
|
- Rakefile
|
24
45
|
- better_input-0.1.0.gem
|
46
|
+
- better_input-0.1.1.gem
|
25
47
|
- lib/better_input.rb
|
26
48
|
- lib/better_input/version.rb
|
27
49
|
- sig/better_input.rbs
|
@@ -52,3 +74,4 @@ signing_key:
|
|
52
74
|
specification_version: 4
|
53
75
|
summary: A better input function for ruby
|
54
76
|
test_files: []
|
77
|
+
...
|