accessor-utilities 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,9 @@ module AccessorUtilities::StringInstance
14
14
  ###################
15
15
 
16
16
  def variable_name
17
- return ( is_variable_name? ? to_sym : ( '@' + self ).to_sym )
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
- return ( self[ length - 1 ] == '=' ? to_sym : ( self + '=' ).to_sym )
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
  ##################
@@ -1,6 +1,6 @@
1
1
 
2
2
  module AccessorUtilities::Swizzle
3
-
3
+
4
4
  ####################
5
5
  # swizzle_method #
6
6
  ####################
@@ -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: false
5
- segments:
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-07-16 00:00:00 -04:00
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.3.7
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.