Module: AccessorUtilities::AccessorMath

Defined in:
lib/accessor_utilities/accessor_math.rb

Instance Method Summary collapse

Instance Method Details

#status_minus_other_status(existing_status, other_status) ⇒ Object

status_minus_other_status #



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/accessor_utilities/accessor_math.rb', line 51

def status_minus_other_status( existing_status, other_status )
  
  status = nil
  
  case existing_status
    
    when :accessor

      case other_status
        when :accessor
          status = nil
        when :reader
          status = :writer
        when :writer
          status = :reader
        else
          status = :accessor
      end

    when :reader

      case other_status
        when :reader, :accessor
          status = nil
        else
          status = :reader
      end

    when :writer

      case other_status
        when :writer, :accessor
          status = nil
        else
          status = :writer
      end
    
  end
  
  return status
  
end

#status_plus_other_status(existing_status, other_status) ⇒ Object

status_plus_other_status #



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/accessor_utilities/accessor_math.rb', line 9

def status_plus_other_status( existing_status, other_status )
  
  status = nil
  
  case existing_status
    
    when :accessor

      status = :accessor

    when :reader

      case other_status
        when :writer, :accessor
          status = :accessor
        else
          status = :reader
      end

    when :writer

      case other_status
        when :reader, :accessor
          status = :accessor
        else
          status = :writer
      end
      
    when nil
      
      return other_status
    
  end
  
  return status
  
end