accessor-utilities 1.0.3 → 1.0.4

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.
@@ -23,6 +23,86 @@ module AccessorUtilities::StringInstance
23
23
 
24
24
  end
25
25
 
26
+ #######################
27
+ # is_accessor_name? #
28
+ #######################
29
+
30
+ def is_accessor_name?
31
+
32
+ is_accessor_name = false
33
+
34
+ case self[ 0 ]
35
+
36
+ when '@'
37
+
38
+ else
39
+
40
+ last_index = length - 1
41
+ case self[ last_index ]
42
+ when '=', '?'
43
+ is_accessor_name = false
44
+ else
45
+ is_accessor_name = true
46
+ end
47
+
48
+ end
49
+
50
+ return is_accessor_name
51
+
52
+ end
53
+
54
+ #############################
55
+ # is_write_accessor_name? #
56
+ #############################
57
+
58
+ def is_write_accessor_name?
59
+
60
+ is_write_accessor_name = false
61
+
62
+ case self[ 0 ]
63
+
64
+ when '@'
65
+
66
+ else
67
+
68
+ last_index = length - 1
69
+ case self[ last_index ]
70
+ when '='
71
+ is_write_accessor_name = true
72
+ end
73
+
74
+ end
75
+
76
+ return is_write_accessor_name
77
+
78
+ end
79
+
80
+ ###########################
81
+ # is_set_accessor_name? #
82
+ ###########################
83
+
84
+ def is_set_accessor_name?
85
+
86
+ is_write_accessor_name = false
87
+
88
+ case self[ 0 ]
89
+
90
+ when '@'
91
+
92
+ else
93
+
94
+ last_index = length - 1
95
+ case self[ last_index ]
96
+ when '?'
97
+ is_write_accessor_name = true
98
+ end
99
+
100
+ end
101
+
102
+ return is_write_accessor_name
103
+
104
+ end
105
+
26
106
  ###################
27
107
  # variable_name #
28
108
  ###################
@@ -11,6 +11,36 @@ module AccessorUtilities::SymbolInstance
11
11
 
12
12
  end
13
13
 
14
+ #######################
15
+ # is_accessor_name? #
16
+ #######################
17
+
18
+ def is_accessor_name?
19
+
20
+ return to_s.is_accessor_name?
21
+
22
+ end
23
+
24
+ #############################
25
+ # is_write_accessor_name? #
26
+ #############################
27
+
28
+ def is_write_accessor_name?
29
+
30
+ return to_s.is_write_accessor_name?
31
+
32
+ end
33
+
34
+ ###########################
35
+ # is_set_accessor_name? #
36
+ ###########################
37
+
38
+ def is_set_accessor_name?
39
+
40
+ return to_s.is_set_accessor_name?
41
+
42
+ end
43
+
14
44
  ###################
15
45
  # variable_name #
16
46
  ###################
@@ -14,6 +14,39 @@ describe AccessorUtilities::StringInstance do
14
14
  'not_variable?'.is_variable_name?.should == false
15
15
  end
16
16
 
17
+ #######################
18
+ # is_accessor_name? #
19
+ #######################
20
+
21
+ it 'can report if a string is an accessor name' do
22
+ '@variable'.is_accessor_name?.should == false
23
+ 'not_variable'.is_accessor_name?.should == true
24
+ 'not_variable='.is_accessor_name?.should == false
25
+ 'not_variable?'.is_accessor_name?.should == false
26
+ end
27
+
28
+ #############################
29
+ # is_write_accessor_name? #
30
+ #############################
31
+
32
+ it 'can report if a string is a write accessor name' do
33
+ '@variable'.is_write_accessor_name?.should == false
34
+ 'not_variable'.is_write_accessor_name?.should == false
35
+ 'not_variable='.is_write_accessor_name?.should == true
36
+ 'not_variable?'.is_write_accessor_name?.should == false
37
+ end
38
+
39
+ ###########################
40
+ # is_set_accessor_name? #
41
+ ###########################
42
+
43
+ it 'can report if a string is an is_set? name' do
44
+ '@variable'.is_set_accessor_name?.should == false
45
+ 'not_variable'.is_set_accessor_name?.should == false
46
+ 'not_variable='.is_set_accessor_name?.should == false
47
+ 'not_variable?'.is_set_accessor_name?.should == true
48
+ end
49
+
17
50
  ###################
18
51
  # variable_name #
19
52
  ###################
@@ -14,6 +14,39 @@ describe AccessorUtilities::SymbolInstance do
14
14
  :not_variable?.is_variable_name?.should == false
15
15
  end
16
16
 
17
+ #######################
18
+ # is_accessor_name? #
19
+ #######################
20
+
21
+ it 'can report if a string is an accessor name' do
22
+ :@variable.is_accessor_name?.should == false
23
+ :not_variable.is_accessor_name?.should == true
24
+ :not_variable=.is_accessor_name?.should == false
25
+ :not_variable?.is_accessor_name?.should == false
26
+ end
27
+
28
+ #############################
29
+ # is_write_accessor_name? #
30
+ #############################
31
+
32
+ it 'can report if a string is a write accessor name' do
33
+ :@variable.is_write_accessor_name?.should == false
34
+ :not_variable.is_write_accessor_name?.should == false
35
+ :not_variable=.is_write_accessor_name?.should == true
36
+ :not_variable?.is_write_accessor_name?.should == false
37
+ end
38
+
39
+ ###########################
40
+ # is_set_accessor_name? #
41
+ ###########################
42
+
43
+ it 'can report if a string is a write accessor name' do
44
+ :@variable.is_set_accessor_name?.should == false
45
+ :not_variable.is_set_accessor_name?.should == false
46
+ :not_variable=.is_set_accessor_name?.should == false
47
+ :not_variable?.is_set_accessor_name?.should == true
48
+ end
49
+
17
50
  ###################
18
51
  # variable_name #
19
52
  ###################
@@ -33,7 +66,7 @@ describe AccessorUtilities::SymbolInstance do
33
66
  :@variable.accessor_name.should == :variable
34
67
  :not_variable.accessor_name.should == :not_variable
35
68
  :not_variable=.accessor_name.should == :not_variable
36
- :not_variable?.accessor_name.should == :not_variable
69
+ :not_variable?.accessor_name.should == :not_variable?
37
70
  end
38
71
 
39
72
  #########################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accessor-utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000 Z
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Extends String and Symbol instances with variable/accessor methods, provides
15
15
  swizzling helpers, provides accessor-related math for transforming :accessor, :reader,
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  version: '0'
55
55
  requirements: []
56
56
  rubyforge_project: accessor-utilities
57
- rubygems_version: 1.8.10
57
+ rubygems_version: 1.8.11
58
58
  signing_key:
59
59
  specification_version: 3
60
60
  summary: Utility methods for accessor-related meta-programming.