accessor-utilities 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,14 @@ module AccessorUtilities::StringInstance
35
35
 
36
36
  variable_name_string = '@' + accessor_name.to_s
37
37
 
38
+ end
39
+
40
+ last_index = variable_name_string.length - 1
41
+
42
+ if variable_name_string[ last_index ] == '?'
43
+
44
+ variable_name_string = variable_name_string.slice( 0, last_index )
45
+
38
46
  end
39
47
 
40
48
  return variable_name_string.to_sym
@@ -52,8 +60,7 @@ module AccessorUtilities::StringInstance
52
60
  last_index = length - 1
53
61
  last_character = self[ last_index ]
54
62
 
55
- if last_character == '?' or
56
- last_character == '='
63
+ if last_character == '='
57
64
 
58
65
  accessor_name_string = slice( 0, last_index )
59
66
 
@@ -90,7 +97,17 @@ module AccessorUtilities::StringInstance
90
97
 
91
98
  else
92
99
 
93
- write_accessor_name_string = accessor_name.to_s + '='
100
+ write_accessor_name_string = accessor_name.to_s
101
+
102
+ last_index = write_accessor_name_string.length - 1
103
+
104
+ if write_accessor_name_string[ last_index ] == '?'
105
+
106
+ write_accessor_name_string.slice!( last_index, last_index + 1 )
107
+
108
+ end
109
+
110
+ write_accessor_name_string.concat( '=' )
94
111
 
95
112
  end
96
113
 
@@ -33,7 +33,7 @@ describe AccessorUtilities::StringInstance do
33
33
  '@variable'.accessor_name.should == :variable
34
34
  'not_variable'.accessor_name.should == :not_variable
35
35
  'not_variable='.accessor_name.should == :not_variable
36
- 'not_variable?'.accessor_name.should == :not_variable
36
+ 'not_variable?'.accessor_name.should == :not_variable?
37
37
  end
38
38
 
39
39
  #########################
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.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: