filigree 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -14
- data/Rakefile +5 -6
- data/lib/filigree/request_file.rb +1 -1
- data/lib/filigree/types.rb +10 -10
- data/lib/filigree/version.rb +1 -1
- metadata +28 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dccb22f2a08a333864492679856a0b37cc014b31
|
4
|
+
data.tar.gz: 7bff283cd79b85f5c54bdd6d1dcc54a1ab93cc20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26ef0356f6547ae4a8cfac5b3b3972e228d2fa8807f2f98b4a85adec6f96244f8f525ba9ee7ad9742cff1361c3bbbdcf554a8847c97a3f8dee95448cfe719148
|
7
|
+
data.tar.gz: 48a9e5758c19cdb3c31c3e59069044a073ffced5dfc60928dd8ac1cbc2e13245c826283917ecfdc27726efd7b05d0e8429ab51140bc205c58d016164a44e0b1c
|
data/README.md
CHANGED
@@ -7,15 +7,15 @@ Filigree: For more beautiful Ruby
|
|
7
7
|
|
8
8
|
Filigree is a collection of classes, modules, and functions that I found myself re-writing in each of my projects. In addition, I have thrown in a couple of other features that I've always wanted. Most of these features can be used independently. Bellow is a list of many of the files and the features that each file provides:
|
9
9
|
|
10
|
-
* **filigree/abstract_class
|
11
|
-
* **filigree/application
|
12
|
-
* **filigree/class_methods_module
|
13
|
-
* **filigree/commands
|
14
|
-
* **filigree/configuration
|
15
|
-
* **filigree/match
|
16
|
-
* **filigree/request_file
|
17
|
-
* **filigree/types
|
18
|
-
* **filigree/visitor
|
10
|
+
* **filigree/abstract_class** - Abstract class and method implementations
|
11
|
+
* **filigree/application** - A basic application framework
|
12
|
+
* **filigree/class_methods_module** - Easy way to include class methods in a mixin
|
13
|
+
* **filigree/commands** - Framework for defining and processing command lines
|
14
|
+
* **filigree/configuration** - Framework for parsing configuration strings
|
15
|
+
* **filigree/match** - An implementation of pattern matching for Ruby
|
16
|
+
* **filigree/request_file** - Conditionally do something if a file can be included; great for Rakefiles
|
17
|
+
* **filigree/types** - Helper functions/classes for type checking ruby code; great for FFI integration
|
18
|
+
* **filigree/visitor** - Implementation of the Visitor pattern based on pattern matching library
|
19
19
|
|
20
20
|
The above is not a complete list of files provided by this gem, and the documentation bellow only covers the most important features of the library. Explore the rest of the documentation to discover additional features.
|
21
21
|
|
@@ -119,7 +119,7 @@ Destructuring patterns allow you to match against an instance of a class, while
|
|
119
119
|
```Ruby
|
120
120
|
class Foo
|
121
121
|
include Filigree::Destructurable
|
122
|
-
|
122
|
+
def initialize(a, b)
|
123
123
|
@a = a
|
124
124
|
@b = b
|
125
125
|
end
|
@@ -336,8 +336,6 @@ var.bar = '42' # Raises a TypeError
|
|
336
336
|
Contributing
|
337
337
|
------------
|
338
338
|
|
339
|
-
Do you have bits of code that you use in all of your projects but arn't big enough for
|
339
|
+
Do you have bits of code that you use in all of your projects but arn't big enough for their own gem? Well, maybe your code could find a home in Filigree! Send me a patch that includes the useful bits and some tests and I'll see about adding it.
|
340
340
|
|
341
|
-
Other than that, what Filigree really needs is
|
342
|
-
|
343
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/chriswailes/filigree/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
341
|
+
Other than that, what Filigree really needs is users. Add it to your project and let me know what features you use and which you don't; where you would like to see improvements, and what pieces you really liked. Above all, submit issues if you encounter any bugs!
|
data/Rakefile
CHANGED
@@ -88,14 +88,13 @@ end
|
|
88
88
|
|
89
89
|
request_file('yard', 'Yard is not installed.') do
|
90
90
|
YARD::Rake::YardocTask.new do |t|
|
91
|
-
t.options
|
92
|
-
'--title',
|
93
|
-
'-m',
|
94
|
-
'-M',
|
95
|
-
'-c', '.yardoc/cache',
|
91
|
+
t.options = [
|
92
|
+
'--title', 'Filigree',
|
93
|
+
'-m', 'markdown',
|
94
|
+
'-M', 'redcarpet',
|
96
95
|
'--private'
|
97
96
|
]
|
98
97
|
|
99
|
-
t.files
|
98
|
+
t.files = Dir['lib/**/*.rb']
|
100
99
|
end
|
101
100
|
end
|
@@ -24,7 +24,7 @@ def request_file(file, print_failure = false)
|
|
24
24
|
require file
|
25
25
|
yield if block_given?
|
26
26
|
rescue LoadError
|
27
|
-
if
|
27
|
+
if print_failure.is_a?(String)
|
28
28
|
puts print_failure
|
29
29
|
elsif print_failure
|
30
30
|
puts "Unable to require file: #{file}"
|
data/lib/filigree/types.rb
CHANGED
@@ -18,17 +18,17 @@ require 'filigree/class_methods_module'
|
|
18
18
|
|
19
19
|
# A method for type checking Ruby values.
|
20
20
|
#
|
21
|
-
# @param [Object] obj Object to type check
|
22
|
-
# @param [Class] type Class the object should be an instance of
|
23
|
-
# @param [String, nil] blame Variable name to blame for failed type checks
|
21
|
+
# @param [Object] obj Object to type check
|
22
|
+
# @param [Class] type Class the object should be an instance of
|
23
|
+
# @param [String, nil] blame Variable name to blame for failed type checks
|
24
24
|
# @param [Boolean] nillable Object can be nil?
|
25
|
-
# @param [Boolean] strict Strict or non-strict checking. Uses `instance_of?` and `is_a?` respectively
|
25
|
+
# @param [Boolean] strict Strict or non-strict checking. Uses `instance_of?` and `is_a?` respectively
|
26
26
|
#
|
27
|
-
# @raise [ArgumentError]
|
27
|
+
# @raise [ArgumentError] An error is raise if the type checking fails.
|
28
28
|
#
|
29
|
-
# @return [Object]
|
29
|
+
# @return [Object] The object passed as parameter obj
|
30
30
|
def check_type(obj, type, blame = nil, nillable = false, strict = false)
|
31
|
-
type_ok =
|
31
|
+
type_ok = (obj.nil? && nillable) || (strict ? obj.instance_of?(type) : obj.is_a?(type))
|
32
32
|
|
33
33
|
if type_ok
|
34
34
|
obj
|
@@ -51,12 +51,12 @@ end
|
|
51
51
|
# @param [Boolean] nillable Object can be nil?
|
52
52
|
# @param [Boolean] strict Strict or non-strict checking. Uses `instance_of?` and `is_a?` respectively.
|
53
53
|
#
|
54
|
-
# @raise [ArgumentError]
|
54
|
+
# @raise [ArgumentError] An error is raise if the type checking fails
|
55
55
|
#
|
56
|
-
# @return [Object]
|
56
|
+
# @return [Object] The object passed in parameter array
|
57
57
|
def check_array_type(array, type, blame = nil, nillable = false, strict = false)
|
58
58
|
array.each do |obj|
|
59
|
-
type_ok =
|
59
|
+
type_ok = (obj.nil? && nillable) || (strict ? obj.instance_of?(type) : obj.is_a?(type))
|
60
60
|
|
61
61
|
if not type_ok
|
62
62
|
if blame
|
data/lib/filigree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filigree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wailes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
version: 0.8.1
|
167
167
|
description: Filigree provides new classes and extensions to core library classes
|
168
168
|
that add functionality to Ruby.
|
169
|
-
email: chris.wailes@gmail.com
|
169
|
+
email: chris.wailes+filigree@gmail.com
|
170
170
|
executables: []
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
@@ -175,33 +175,33 @@ files:
|
|
175
175
|
- AUTHORS
|
176
176
|
- README.md
|
177
177
|
- Rakefile
|
178
|
+
- lib/filigree/request_file.rb
|
179
|
+
- lib/filigree/class_methods_module.rb
|
180
|
+
- lib/filigree/visitor.rb
|
178
181
|
- lib/filigree/types.rb
|
182
|
+
- lib/filigree/object.rb
|
183
|
+
- lib/filigree/string.rb
|
184
|
+
- lib/filigree/commands.rb
|
185
|
+
- lib/filigree/abstract_class.rb
|
179
186
|
- lib/filigree/boolean.rb
|
180
|
-
- lib/filigree/match.rb
|
181
187
|
- lib/filigree/application.rb
|
182
|
-
- lib/filigree/abstract_class.rb
|
183
|
-
- lib/filigree/class.rb
|
184
|
-
- lib/filigree/string.rb
|
185
188
|
- lib/filigree/version.rb
|
186
189
|
- lib/filigree/configuration.rb
|
187
|
-
- lib/filigree/
|
188
|
-
- lib/filigree/
|
189
|
-
- lib/filigree/commands.rb
|
190
|
-
- lib/filigree/request_file.rb
|
191
|
-
- lib/filigree/class_methods_module.rb
|
190
|
+
- lib/filigree/match.rb
|
191
|
+
- lib/filigree/class.rb
|
192
192
|
- lib/filigree.rb
|
193
|
-
- test/tc_boolean.rb
|
194
|
-
- test/tc_object.rb
|
195
|
-
- test/tc_types.rb
|
196
|
-
- test/tc_configuration.rb
|
197
193
|
- test/tc_commands.rb
|
194
|
+
- test/tc_types.rb
|
195
|
+
- test/tc_class.rb
|
198
196
|
- test/tc_string.rb
|
197
|
+
- test/tc_application.rb
|
198
|
+
- test/tc_match.rb
|
199
199
|
- test/tc_abstract_class.rb
|
200
|
-
- test/
|
200
|
+
- test/tc_object.rb
|
201
201
|
- test/tc_class_methods_module.rb
|
202
|
-
- test/
|
203
|
-
- test/
|
204
|
-
- test/
|
202
|
+
- test/tc_configuration.rb
|
203
|
+
- test/tc_boolean.rb
|
204
|
+
- test/tc_visitor.rb
|
205
205
|
- test/ts_filigree.rb
|
206
206
|
homepage: https://github.com/chriswailes/filigree
|
207
207
|
licenses:
|
@@ -228,17 +228,17 @@ signing_key:
|
|
228
228
|
specification_version: 4
|
229
229
|
summary: Extra functionality for Ruby.
|
230
230
|
test_files:
|
231
|
-
- test/tc_boolean.rb
|
232
|
-
- test/tc_object.rb
|
233
|
-
- test/tc_types.rb
|
234
|
-
- test/tc_configuration.rb
|
235
231
|
- test/tc_commands.rb
|
232
|
+
- test/tc_types.rb
|
233
|
+
- test/tc_class.rb
|
236
234
|
- test/tc_string.rb
|
235
|
+
- test/tc_application.rb
|
236
|
+
- test/tc_match.rb
|
237
237
|
- test/tc_abstract_class.rb
|
238
|
-
- test/
|
238
|
+
- test/tc_object.rb
|
239
239
|
- test/tc_class_methods_module.rb
|
240
|
-
- test/
|
241
|
-
- test/
|
242
|
-
- test/
|
240
|
+
- test/tc_configuration.rb
|
241
|
+
- test/tc_boolean.rb
|
242
|
+
- test/tc_visitor.rb
|
243
243
|
- test/ts_filigree.rb
|
244
244
|
has_rdoc:
|