Module: SafetyAttributeHelper

Defined in:
lib/safety/safety_attribute_helper.rb

Class Method Summary collapse

Class Method Details

.parse_attribute_type(method) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/safety/safety_attribute_helper.rb', line 2

def self.parse_attribute_type method
  if method.to_s =~ /attr_accessor_[a-zA-Z_]*/
    :accessor 
  elsif method.to_s =~ /attr_reader_[a-zA-Z_]*/
    :reader
  elsif method.to_s =~ /attr_writer_[a-zA-Z_]*/
    :writer
  else
    nil
  end
end