projector_pws 0.1.0 → 0.1.1
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 +2 -192
- data/lib/projector_pws/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a24194fba2e7a161d78b40a61d197ab9051e34
|
4
|
+
data.tar.gz: f8695f7853e46a4197bf478d24a58c1ae764ceb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feea5aed83b2037da9a117f530979c201178ac78a9b3d7145ebb8cdbbf321458bb7faa352b2725ae2d8531856b02281f5e5052d0b893c1c52153a4bc5e55f3be
|
7
|
+
data.tar.gz: 8e8fbdd33e55ee705cf707617159a5d1d469d53d601bf8a3f4dfaa08dc1985368bd6d17b972660012b099a7e43de54c566269e0b75415a077d806919a0af9905
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# ProjectorPWS
|
2
2
|
|
3
|
-
Client library for accessing Projector PSA
|
3
|
+
Client library for accessing Projector PSA's Web Services (PWS)
|
4
4
|
|
5
5
|
## Presentation
|
6
6
|
|
7
|
-
This library provides access to Projector PSA
|
7
|
+
This library provides access to Projector PSA's Web Services (PWS).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -18,196 +18,6 @@ gem 'projector_pws'
|
|
18
18
|
gem install -V projector_pws
|
19
19
|
```
|
20
20
|
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
### Symbolize Keys
|
24
|
-
|
25
|
-
A _sym_keys_ method is monkey-patched into the *Array* and *Hash* classes, and provides a way to recursively convert *keys* to *symbols*.
|
26
|
-
This is mostly useful when loading Hashes from external resources (YAML, CSV, JSON, etc...), where keys will be stored as strings.
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
a = { 'foo' => 'bar', 'nested' => [{ 'problems' => 'none' }] }
|
30
|
-
a.sym_keys
|
31
|
-
# => {:foo=>"bar", :nested=>[{:problems=>"none"}]}
|
32
|
-
```
|
33
|
-
|
34
|
-
### Deep-clone
|
35
|
-
|
36
|
-
A _dclone_ method is monkey-patched into the *Array* and *Hash* classes, and provides a way to recursively *deep-clone* an instance.
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
a = { foo: 'bar', bar: :kill_me, nested: [{ problems: 'none' }] }
|
40
|
-
b = a.dclone
|
41
|
-
b[:nested] << :foo
|
42
|
-
b[:nested][:problems] = 'no way'
|
43
|
-
b[:test] = :bork
|
44
|
-
b[:foo] = nil
|
45
|
-
b.delete :bar
|
46
|
-
a
|
47
|
-
# => {:foo=>nil, :nested=>[{:problems=>"no way"}, :foo], :test => :bork}
|
48
|
-
b
|
49
|
-
# => {:foo=>"bar", :nested=>[{:problems=>"none"}]}
|
50
|
-
```
|
51
|
-
|
52
|
-
### Right/Left Padding
|
53
|
-
|
54
|
-
Two padding methods _rpad_ and _lpad_ are monkey-patched into the *String* class, and provide a way to pad any string to a given length using a given filler string.
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
a = 'foo'
|
58
|
-
a.rpad 10
|
59
|
-
# => "foo "
|
60
|
-
a.rpad 10, '-'
|
61
|
-
# => "foo-------"
|
62
|
-
a.rpad 2, '-'
|
63
|
-
# => "fo"
|
64
|
-
a.lpad 10
|
65
|
-
# => " foo"
|
66
|
-
a.lpad 10, '-'
|
67
|
-
# => "-------foo"
|
68
|
-
a.rpad 2, '-'
|
69
|
-
# => "oo"
|
70
|
-
```
|
71
|
-
|
72
|
-
### Object Try (Undefined Method Call)
|
73
|
-
|
74
|
-
A _try_ method is monkey-patched into the *Object* root class, providing a means to call undefined methods on objects without raising anything (returning *nil* instead).
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
'foobar'.try :foo
|
78
|
-
# => nil
|
79
|
-
32.try :to_s
|
80
|
-
# => '32'
|
81
|
-
32.try :+, 3
|
82
|
-
# => 35
|
83
|
-
['foo', 'bar'].try(:collect) { |e| "-#{e}-" }
|
84
|
-
# => ['-foo-', '-bar-']
|
85
|
-
```
|
86
|
-
|
87
|
-
### Get Non-Empty String
|
88
|
-
|
89
|
-
A _nstr_ method is monkey-patched into the *String* class. This method returns nil when the String is empty, the String otherwise.
|
90
|
-
|
91
|
-
```ruby
|
92
|
-
''.nstr
|
93
|
-
# => nil
|
94
|
-
'foo'.nstr
|
95
|
-
# => 'foo'
|
96
|
-
nil.try :nstr
|
97
|
-
# => nil
|
98
|
-
'bar'.try :nstr
|
99
|
-
# => 'bar'
|
100
|
-
```
|
101
|
-
|
102
|
-
### String Case Conversions
|
103
|
-
|
104
|
-
Case-conversion methods are monkey-patched into the *String* class. The following methods are made available:
|
105
|
-
* camelcase ('foo-bar' => 'FooBar')
|
106
|
-
* snakecase ('FooBar' => 'foo-bar')
|
107
|
-
* kebabcase ('FooBar' => 'foo_bar')
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
'foo_bar'.camelcase
|
111
|
-
# => 'FooBar'
|
112
|
-
'foo-bar'.camelcase
|
113
|
-
# => 'FooBar'
|
114
|
-
|
115
|
-
'FooBar'.snakecase
|
116
|
-
# => 'foo-bar'
|
117
|
-
'foo_bar'.snakecase
|
118
|
-
# => 'foo-bar'
|
119
|
-
|
120
|
-
'FooBar'.kebabcase
|
121
|
-
# => 'foo_bar'
|
122
|
-
'foo-bar'.kebabcase
|
123
|
-
# => 'foo_bar'
|
124
|
-
```
|
125
|
-
|
126
|
-
### Module utilities
|
127
|
-
|
128
|
-
#### Get Module Name
|
129
|
-
|
130
|
-
A _mod_name_ method is monkey-patched into the *Module* class. This allows obtaining the name of any module, without its hierarchical tree.
|
131
|
-
|
132
|
-
```ruby
|
133
|
-
module Foo
|
134
|
-
module Bar
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
Foo.name
|
139
|
-
# => 'Foo'
|
140
|
-
|
141
|
-
Foo.mod_name
|
142
|
-
# => 'Foo'
|
143
|
-
|
144
|
-
Foo::Bar.name
|
145
|
-
# => 'Foo::Bar'
|
146
|
-
|
147
|
-
Foo::Bar.mod_name # <= This is where it gets interesting
|
148
|
-
# => 'Bar'
|
149
|
-
```
|
150
|
-
|
151
|
-
#### Get Module Parent Name
|
152
|
-
|
153
|
-
A _mod_parent_name_ method is monkey-patched into the *Module* class. This allows obtaining the name of any module's parent.
|
154
|
-
|
155
|
-
```ruby
|
156
|
-
module Foo
|
157
|
-
module Bar
|
158
|
-
module Test
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
Foo.mod_parent_name
|
164
|
-
# => ''
|
165
|
-
|
166
|
-
Foo::Bar.mod_parent_name
|
167
|
-
# => 'Foo'
|
168
|
-
|
169
|
-
Foo::Bar::Test.mod_parent_name
|
170
|
-
# => 'Foo::Bar'
|
171
|
-
```
|
172
|
-
|
173
|
-
#### Get Module Parent
|
174
|
-
|
175
|
-
A _mod_parent_ method is monkey-patched into the *Module* class. This allows obtaining any module's parent.
|
176
|
-
|
177
|
-
```ruby
|
178
|
-
module Foo
|
179
|
-
module Bar
|
180
|
-
module Test
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
Foo.mod_parent
|
186
|
-
# => nil
|
187
|
-
|
188
|
-
Foo::Bar.mod_parent
|
189
|
-
# => Foo
|
190
|
-
|
191
|
-
Foo::Bar::Test.mod_parent_name
|
192
|
-
# => Foo::Bar
|
193
|
-
```
|
194
|
-
|
195
|
-
### Time Duration
|
196
|
-
|
197
|
-
A _duration_ method is monkey-patched into the 'Numeric' class. This method returns a textual string representation of the time duration.
|
198
|
-
An optional *elements* argument allows setting the maximum number of time-elements (days, hours, minutes, ...) to display.
|
199
|
-
|
200
|
-
```ruby
|
201
|
-
86400.duration
|
202
|
-
# => '1 Day'
|
203
|
-
((3600 * 3) + 60 + 12).duration
|
204
|
-
# => '3 Hours 1 Minute 12 Seconds'
|
205
|
-
((3600 * 3) + 60 + 12).duration 1
|
206
|
-
# => '3 Hours'
|
207
|
-
((3600 * 3) + 60 + 12).duration 2
|
208
|
-
# => '3 Hours 1 Minute'
|
209
|
-
```
|
210
|
-
|
211
21
|
## License
|
212
22
|
|
213
23
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|