inch 0.3.2 → 0.3.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32657c657481312dac6a4325355524bdc9e04642
|
4
|
+
data.tar.gz: e79fb87d207616b128252f8bf5f27ae4c6aa0a18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d460817a8091d42386e72b936bcfdb46ae9fb461f8da4fc6486c3870d29bf1646dacd583f9329a9518b116d9f3e5d460b3bd5ef2924e98f3cb7c79ef4bdf9ff2
|
7
|
+
data.tar.gz: 399b22d66754c8641d96eba9a586843d961fb3930c6d7c9b5c9848c809b643b80a5c5bc08b227e6ce549cbe027ad9df04a47ab988942d6036fa1d9ec29de0a24
|
data/README.md
CHANGED
@@ -78,6 +78,33 @@ Inch will suggest that the docs could be improved:
|
|
78
78
|
Only considering priority objects: ↑ ↗ → (use `--help` for options).
|
79
79
|
|
80
80
|
|
81
|
+
|
82
|
+
## Configuration
|
83
|
+
|
84
|
+
By default, Inch looks into `{app,lib}/**/*.rb` for Ruby source files. You can customize this by either passing the desired files to the executable:
|
85
|
+
|
86
|
+
$ inch suggest plugins/**/*.rb
|
87
|
+
|
88
|
+
or by creating a file named `.inch.yml` in your project directory:
|
89
|
+
|
90
|
+
```yaml
|
91
|
+
files:
|
92
|
+
# define files included in the analysis (defaults to ["{app,lib}/**/*.rb"])
|
93
|
+
included:
|
94
|
+
- plugins/**/*.rb
|
95
|
+
# define files excluded from the analysis (defaults to [])
|
96
|
+
excluded:
|
97
|
+
# you can use file paths
|
98
|
+
- plugins/vendor/sparkr/sparkr.rb
|
99
|
+
# or globs
|
100
|
+
- plugins/vendor/**/*.rb
|
101
|
+
# or regular expressions
|
102
|
+
- !ruby/regexp /vendor/
|
103
|
+
```
|
104
|
+
|
105
|
+
As you would expect, `included` sets an array of included files (or globs) and `excluded` sets an array of files, globs or regexes of files to exclude from the evaluation.
|
106
|
+
|
107
|
+
|
81
108
|
## Philosophy
|
82
109
|
|
83
110
|
Inch was created to help people document their code, therefore it may be more important to look at **what it does not** do than at what it does.
|
@@ -36,10 +36,15 @@ module Inch
|
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
39
|
+
def overloaded?
|
40
|
+
end
|
41
|
+
|
39
42
|
def parameters
|
40
43
|
@parameters ||= all_parameter_names.map do |name|
|
41
44
|
signature_name = in_signature(name)
|
42
|
-
tag = parameter_tag(name) || parameter_tag(signature_name)
|
45
|
+
tag = parameter_tag(name) || parameter_tag(signature_name) ||
|
46
|
+
overload_tag_with_parameter(name)
|
47
|
+
|
43
48
|
MethodParameterObject.new(self, name, signature_name, tag)
|
44
49
|
end
|
45
50
|
end
|
@@ -106,8 +111,35 @@ module Inch
|
|
106
111
|
(signature_parameter_names & possible_names).first
|
107
112
|
end
|
108
113
|
|
114
|
+
def normalize_parameter_name(name)
|
115
|
+
# remove leading and trailing brackets
|
116
|
+
# (sometimes used to indicate optional parameters in overload
|
117
|
+
# signatures)
|
118
|
+
name.gsub(/[\[\]]/, '')
|
119
|
+
end
|
120
|
+
|
121
|
+
def overload_tags
|
122
|
+
object.tags(:overload)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Returns all parameter names from all overload signatures.
|
126
|
+
# @todo analyse each signature on its own
|
127
|
+
def overloaded_parameter_names
|
128
|
+
overload_tags.map do |tag|
|
129
|
+
tag.parameters.map do |parameter|
|
130
|
+
normalize_parameter_name(parameter[0])
|
131
|
+
end
|
132
|
+
end.flatten
|
133
|
+
end
|
134
|
+
|
135
|
+
def overload_tag_with_parameter(name)
|
136
|
+
overload_tags.detect do |tag|
|
137
|
+
tag.parameters.map(&:first).include?(name)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
109
141
|
def signature_parameter_names
|
110
|
-
object.parameters.map(&:first)
|
142
|
+
object.parameters.map(&:first) + overloaded_parameter_names
|
111
143
|
end
|
112
144
|
|
113
145
|
def parameter_tag(param_name)
|
data/lib/inch/version.rb
CHANGED
@@ -30,6 +30,132 @@ module Foo
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
module Overloading
|
34
|
+
# Creates a {Sass::Script::Value::Color Color} object from red, green, and
|
35
|
+
# blue values.
|
36
|
+
#
|
37
|
+
# @see #rgba
|
38
|
+
# @overload rgb($red, $green, $blue)
|
39
|
+
# @param $red [Sass::Script::Value::Number] The amount of red in the color.
|
40
|
+
# Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
41
|
+
# inclusive
|
42
|
+
# @param $green [Sass::Script::Value::Number] The amount of green in the
|
43
|
+
# color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
44
|
+
# inclusive
|
45
|
+
# @param $blue [Sass::Script::Value::Number] The amount of blue in the
|
46
|
+
# color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
47
|
+
# inclusive
|
48
|
+
# @return [Sass::Script::Value::Color]
|
49
|
+
# @raise [ArgumentError] if any parameter is the wrong type or out of bounds
|
50
|
+
def rgb(red, green, blue)
|
51
|
+
end
|
52
|
+
# Creates a {Sass::Script::Value::Color Color} from red, green, blue, and
|
53
|
+
# alpha values.
|
54
|
+
# @see #rgb
|
55
|
+
#
|
56
|
+
# @overload rgba($red, $green, $blue, $alpha)
|
57
|
+
# @param $red [Sass::Script::Value::Number] The amount of red in the
|
58
|
+
# color. Must be between 0 and 255 inclusive
|
59
|
+
# @param $green [Sass::Script::Value::Number] The amount of green in the
|
60
|
+
# color. Must be between 0 and 255 inclusive
|
61
|
+
# @param $blue [Sass::Script::Value::Number] The amount of blue in the
|
62
|
+
# color. Must be between 0 and 255 inclusive
|
63
|
+
# @param $alpha [Sass::Script::Value::Number] The opacity of the color.
|
64
|
+
# Must be between 0 and 1 inclusive
|
65
|
+
# @return [Sass::Script::Value::Color]
|
66
|
+
# @raise [ArgumentError] if any parameter is the wrong type or out of
|
67
|
+
# bounds
|
68
|
+
#
|
69
|
+
# @overload rgba($color, $alpha)
|
70
|
+
# Sets the opacity of an existing color.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# rgba(#102030, 0.5) => rgba(16, 32, 48, 0.5)
|
74
|
+
# rgba(blue, 0.2) => rgba(0, 0, 255, 0.2)
|
75
|
+
#
|
76
|
+
# @param $color [Sass::Script::Value::Color] The color whose opacity will
|
77
|
+
# be changed.
|
78
|
+
# @param $alpha [Sass::Script::Value::Number] The new opacity of the
|
79
|
+
# color. Must be between 0 and 1 inclusive
|
80
|
+
# @return [Sass::Script::Value::Color]
|
81
|
+
# @raise [ArgumentError] if `$alpha` is out of bounds or either parameter
|
82
|
+
# is the wrong type
|
83
|
+
def rgba(*args)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Changes one or more properties of a color. This can change the red, green,
|
87
|
+
# blue, hue, saturation, value, and alpha properties. The properties are
|
88
|
+
# specified as keyword arguments, and replace the color's current value for
|
89
|
+
# that property.
|
90
|
+
#
|
91
|
+
# All properties are optional. You can't specify both RGB properties
|
92
|
+
# (`$red`, `$green`, `$blue`) and HSL properties (`$hue`, `$saturation`,
|
93
|
+
# `$value`) at the same time.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# change-color(#102030, $blue: 5) => #102005
|
97
|
+
# change-color(#102030, $red: 120, $blue: 5) => #782005
|
98
|
+
# change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)
|
99
|
+
# @overload change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
|
100
|
+
# @param $color [Sass::Script::Value::Color]
|
101
|
+
# @param $red [Sass::Script::Value::Number] The new red component for the
|
102
|
+
# color, within 0 and 255 inclusive
|
103
|
+
# @param $green [Sass::Script::Value::Number] The new green component for
|
104
|
+
# the color, within 0 and 255 inclusive
|
105
|
+
# @param $blue [Sass::Script::Value::Number] The new blue component for the
|
106
|
+
# color, within 0 and 255 inclusive
|
107
|
+
# @param $hue [Sass::Script::Value::Number] The new hue component for the
|
108
|
+
# color, in degrees
|
109
|
+
# @param $saturation [Sass::Script::Value::Number] The new saturation
|
110
|
+
# component for the color, between `0%` and `100%` inclusive
|
111
|
+
# @param $lightness [Sass::Script::Value::Number] The new lightness
|
112
|
+
# component for the color, within `0%` and `100%` inclusive
|
113
|
+
# @param $alpha [Sass::Script::Value::Number] The new alpha component for
|
114
|
+
# the color, within 0 and 1 inclusive
|
115
|
+
# @return [Sass::Script::Value::Color]
|
116
|
+
# @raise [ArgumentError] if any parameter is the wrong type or out-of
|
117
|
+
# bounds, or if RGB properties and HSL properties are adjusted at the
|
118
|
+
# same time
|
119
|
+
def change_color(color, kwargs)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Mixes two colors together. Specifically, takes the average of each of the
|
123
|
+
# RGB components, optionally weighted by the given percentage. The opacity
|
124
|
+
# of the colors is also considered when weighting the components.
|
125
|
+
#
|
126
|
+
# The weight specifies the amount of the first color that should be included
|
127
|
+
# in the returned color. The default, `50%`, means that half the first color
|
128
|
+
# and half the second color should be used. `25%` means that a quarter of
|
129
|
+
# the first color and three quarters of the second color should be used.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# mix(#f00, #00f) => #7f007f
|
133
|
+
# mix(#f00, #00f, 25%) => #3f00bf
|
134
|
+
# mix(rgba(255, 0, 0, 0.5), #00f) => rgba(63, 0, 191, 0.75)
|
135
|
+
# @overload mix($color1, $color2, $weight: 50%)
|
136
|
+
# @param $color1 [Sass::Script::Value::Color]
|
137
|
+
# @param $color2 [Sass::Script::Value::Color]
|
138
|
+
# @param $weight [Sass::Script::Value::Number] The relative weight of each
|
139
|
+
# color. Closer to `0%` gives more weight to `$color`, closer to `100%`
|
140
|
+
# gives more weight to `$color2`
|
141
|
+
# @return [Sass::Script::Value::Color]
|
142
|
+
# @raise [ArgumentError] if `$weight` is out of bounds or any parameter is
|
143
|
+
# the wrong type
|
144
|
+
def mix(color1, color2, weight = 50)
|
145
|
+
end
|
146
|
+
|
147
|
+
# Retrieve all hooks of a given name, or all hooks if name.nil?
|
148
|
+
# @overload hooks(name)
|
149
|
+
# Retrieve all hooks of a given name
|
150
|
+
# @param name [Symbol]
|
151
|
+
# @return [Array<#call>]
|
152
|
+
# @overload hooks()
|
153
|
+
# Retrieve all hooks
|
154
|
+
# @return [Hash<Symbol,Array<#call>>]
|
155
|
+
def hooks(name = nil)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
33
159
|
module YardError
|
34
160
|
if defined? ::Deprecate
|
35
161
|
Deprecate = ::Deprecate
|
@@ -42,5 +168,4 @@ module YardError
|
|
42
168
|
unless Deprecate.respond_to?(:skip_during)
|
43
169
|
def Deprecate.skip_during; yield; end
|
44
170
|
end
|
45
|
-
|
46
171
|
end
|
@@ -263,4 +263,16 @@ describe ::Inch::CodeObject::Proxy::MethodObject do
|
|
263
263
|
m2 = @objects.find("Foo#method_with_splat_parameter2")
|
264
264
|
assert_equal m1.score, m2.score
|
265
265
|
end
|
266
|
+
|
267
|
+
def test_overloading1
|
268
|
+
list = []
|
269
|
+
list << @objects.find("Overloading#rgb")
|
270
|
+
list << @objects.find("Overloading#rgba")
|
271
|
+
list << @objects.find("Overloading#change_color")
|
272
|
+
list << @objects.find("Overloading#mix")
|
273
|
+
list << @objects.find("Overloading#hooks")
|
274
|
+
list.each do |m|
|
275
|
+
assert_equal 100, m.score.to_i, "#{m.fullname} did not get 100"
|
276
|
+
end
|
277
|
+
end
|
266
278
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -292,12 +292,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
292
292
|
version: '0'
|
293
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
294
|
requirements:
|
295
|
-
- - "
|
295
|
+
- - ">"
|
296
296
|
- !ruby/object:Gem::Version
|
297
|
-
version:
|
297
|
+
version: 1.3.1
|
298
298
|
requirements: []
|
299
299
|
rubyforge_project:
|
300
|
-
rubygems_version: 2.2.
|
300
|
+
rubygems_version: 2.2.2
|
301
301
|
signing_key:
|
302
302
|
specification_version: 4
|
303
303
|
summary: Documentation measurement tool for Ruby
|