accessor-utilities 1.0.0 → 1.0.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.
@@ -14,7 +14,9 @@ module AccessorUtilities::StringInstance
|
|
14
14
|
###################
|
15
15
|
|
16
16
|
def variable_name
|
17
|
-
|
17
|
+
slice_to_index = length - 1
|
18
|
+
variable_name_string = ( self[ slice_to_index ] == '?' ? slice( 0, slice_to_index ) : self )
|
19
|
+
return ( variable_name_string.is_variable_name? ? variable_name_string.to_sym : ( '@' + variable_name_string ).to_sym )
|
18
20
|
end
|
19
21
|
|
20
22
|
###################
|
@@ -30,7 +32,9 @@ module AccessorUtilities::StringInstance
|
|
30
32
|
#########################
|
31
33
|
|
32
34
|
def write_accessor_name
|
33
|
-
|
35
|
+
slice_to_index = length - 1
|
36
|
+
variable_name_string = ( self[ slice_to_index ] == '?' ? slice( 0, slice_to_index ) : self )
|
37
|
+
return ( variable_name_string[ length - 1 ] == '=' ? variable_name_string.to_sym : ( variable_name_string + '=' ).to_sym )
|
34
38
|
end
|
35
39
|
|
36
40
|
##################
|
@@ -19,6 +19,7 @@ describe AccessorUtilities::StringInstance do
|
|
19
19
|
it 'can return variable name for variable or accessor name' do
|
20
20
|
'@variable'.variable_name.should == :@variable
|
21
21
|
'not_variable'.variable_name.should == :@not_variable
|
22
|
+
'not_variable?'.variable_name.should == :@not_variable
|
22
23
|
end
|
23
24
|
|
24
25
|
###################
|
@@ -28,6 +29,7 @@ describe AccessorUtilities::StringInstance do
|
|
28
29
|
it 'can return accessor name for variable or accessor name' do
|
29
30
|
'@variable'.accessor_name.should == :variable
|
30
31
|
'not_variable'.accessor_name.should == :not_variable
|
32
|
+
'not_variable?'.accessor_name.should == :not_variable?
|
31
33
|
end
|
32
34
|
|
33
35
|
#########################
|
@@ -36,6 +38,7 @@ describe AccessorUtilities::StringInstance do
|
|
36
38
|
|
37
39
|
it 'can return write accessor name for accessor name' do
|
38
40
|
'accessor_name'.write_accessor_name.should == :accessor_name=
|
41
|
+
'accessor_name?'.write_accessor_name.should == :accessor_name=
|
39
42
|
end
|
40
43
|
|
41
44
|
##################
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accessor-utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Asher
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable:
|
13
|
+
date: 2011-09-05 00:00:00 Z
|
19
14
|
dependencies: []
|
20
15
|
|
21
16
|
description: Extends String and Symbol instances with variable/accessor methods, provides swizzling helpers, provides accessor-related math for transforming :accessor, :reader, :writer.
|
@@ -42,7 +37,6 @@ files:
|
|
42
37
|
- spec/AccessorUtilities_spec.rb
|
43
38
|
- README.md
|
44
39
|
- README.rdoc
|
45
|
-
has_rdoc: true
|
46
40
|
homepage: http://rubygems.org/gems/accessor-utilities
|
47
41
|
licenses: []
|
48
42
|
|
@@ -56,21 +50,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
50
|
requirements:
|
57
51
|
- - ">="
|
58
52
|
- !ruby/object:Gem::Version
|
59
|
-
segments:
|
60
|
-
- 0
|
61
53
|
version: "0"
|
62
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
55
|
none: false
|
64
56
|
requirements:
|
65
57
|
- - ">="
|
66
58
|
- !ruby/object:Gem::Version
|
67
|
-
segments:
|
68
|
-
- 0
|
69
59
|
version: "0"
|
70
60
|
requirements: []
|
71
61
|
|
72
62
|
rubyforge_project: accessor-utilities
|
73
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.8.10
|
74
64
|
signing_key:
|
75
65
|
specification_version: 3
|
76
66
|
summary: Utility methods for accessor-related meta-programming.
|