parameters 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +98 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +34 -16
- data/lib/parameters/class_methods.rb +11 -3
- data/lib/parameters/class_param.rb +21 -3
- data/lib/parameters/instance_param.rb +9 -4
- data/lib/parameters/param.rb +316 -1
- data/lib/parameters/parameters.rb +43 -26
- data/lib/parameters/version.rb +1 -1
- data/parameters.gemspec +84 -0
- data/spec/class_param_spec.rb +171 -0
- data/spec/instance_param_spec.rb +190 -0
- metadata +34 -95
- data.tar.gz.sig +0 -0
- data/History.rdoc +0 -73
- data/Manifest.txt +0 -31
- data/README.rdoc +0 -91
- data/lib/parameters/parser.rb +0 -136
- data/lib/parameters/yard.rb +0 -1
- data/lib/parameters/yard/handlers.rb +0 -1
- data/lib/parameters/yard/handlers/ruby.rb +0 -2
- data/lib/parameters/yard/handlers/ruby/legacy.rb +0 -1
- data/lib/parameters/yard/handlers/ruby/legacy/parameter_handler.rb +0 -34
- data/lib/parameters/yard/handlers/ruby/parameter_handler.rb +0 -38
- data/spec/parser_spec.rb +0 -47
- metadata.gz.sig +0 -1
data/lib/parameters/yard.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'parameters/yard/handlers'
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'parameters/yard/handlers/ruby'
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'parameters/yard/handlers/ruby/legacy/parameter_handler'
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'yard'
|
2
|
-
|
3
|
-
module YARD
|
4
|
-
module Handlers
|
5
|
-
module Ruby
|
6
|
-
module Legacy
|
7
|
-
class ParameterHandler < Base
|
8
|
-
|
9
|
-
handles /\Aparameter\s/
|
10
|
-
|
11
|
-
def process
|
12
|
-
nobj = namespace
|
13
|
-
mscope = scope
|
14
|
-
name = statement.tokens[2,1].to_s[1..-1]
|
15
|
-
|
16
|
-
register MethodObject.new(nobj, name, mscope) do |o|
|
17
|
-
o.visibility = :public
|
18
|
-
o.source = statement.source
|
19
|
-
o.signature = "def #{name}"
|
20
|
-
end
|
21
|
-
|
22
|
-
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
23
|
-
o.visibility = :public
|
24
|
-
o.source = statement.source
|
25
|
-
o.signature = "def #{name}=(value)"
|
26
|
-
o.parameters = [['value', nil]]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'yard'
|
2
|
-
|
3
|
-
module YARD
|
4
|
-
module Handlers
|
5
|
-
module Ruby
|
6
|
-
class ParameterHandler < Base
|
7
|
-
|
8
|
-
handles method_call(:parameter)
|
9
|
-
|
10
|
-
def process
|
11
|
-
obj = statement.parameters(false).first
|
12
|
-
nobj = namespace
|
13
|
-
mscope = scope
|
14
|
-
name = case obj.type
|
15
|
-
when :symbol_literal
|
16
|
-
obj.jump(:ident, :op, :kw, :const).source
|
17
|
-
when :string_literal
|
18
|
-
obj.jump(:string_content).source
|
19
|
-
end
|
20
|
-
|
21
|
-
register MethodObject.new(nobj, name, mscope) do |o|
|
22
|
-
o.visibility = :public
|
23
|
-
o.source = statement.source
|
24
|
-
o.signature = "def #{name}"
|
25
|
-
end
|
26
|
-
|
27
|
-
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
28
|
-
o.visibility = :public
|
29
|
-
o.source = statement.source
|
30
|
-
o.signature = "def #{name}=(value)"
|
31
|
-
o.parameters = [['value', nil]]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/spec/parser_spec.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'parameters/parser'
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Parameters::Parser do
|
6
|
-
it "should parse string values" do
|
7
|
-
Parameters::Parser.parse_value("'bla \\' \\\" bla'").should == "bla ' \\\" bla"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should parse decimal values" do
|
11
|
-
Parameters::Parser.parse_value("100").should == 100
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should parse octal values" do
|
15
|
-
Parameters::Parser.parse_value("012").should == 10
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should parse hexadecimal values" do
|
19
|
-
Parameters::Parser.parse_value("0xff").should == 0xff
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should parse boolean values" do
|
23
|
-
Parameters::Parser.parse_value('true').should == true
|
24
|
-
Parameters::Parser.parse_value('false').should == false
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should parse URI values" do
|
28
|
-
url = 'http://example.com/'
|
29
|
-
|
30
|
-
Parameters::Parser.parse_value(url).should == URI(url)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should parse params of the form 'name'" do
|
34
|
-
Parameters::Parser.parse_param('var').should == {:var => nil}
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should parse params of the form 'name=value'" do
|
38
|
-
Parameters::Parser.parse_param('var1=test').should == {:var1 => 'test'}
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should parse multiple params" do
|
42
|
-
Parameters::Parser.parse(['var', 'var1=test']).should == {
|
43
|
-
:var => nil,
|
44
|
-
:var1 => 'test'
|
45
|
-
}
|
46
|
-
end
|
47
|
-
end
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
��S)�'q: *vc`L�t縌�J>-�+���<���k�0֍�C|����D(3t�����g�x�r���aF�E�즞��Uj�r�/�CbU5�_��c?�R\9�6CT��x� �����Y��s�.\_�)�,~J��1(0�_u:���b2�*r?�vv�ݣճb�V&R��& bݗp�e��y�ԫ�O��͏%��1�$���<��Fo�_�/��6q¦�6�j��!��U���B ��`�
|