Module: Manhattan

Extended by:
ActiveSupport::Concern
Defined in:
lib/manhattan.rb,
lib/manhattan/version.rb

Defined Under Namespace

Modules: ClassMethods Classes: AlreadyDefinedMethod

Constant Summary collapse

VERSION =
"0.0.4"

Instance Method Summary collapse

Instance Method Details

#default_status_valueObject



24
25
26
# File 'lib/manhattan.rb', line 24

def default_status_value
  self.class.default_status_value
end

#send_if_exists(method) ⇒ Object



28
29
30
# File 'lib/manhattan.rb', line 28

def send_if_exists(method)
  self.send(method) if self.respond_to? method
end

#set_default_valueObject



32
33
34
# File 'lib/manhattan.rb', line 32

def set_default_value
  self.send(status_write_method, status_value(default_status_value)) unless self.status_column_value
end

#status_column_valueObject



8
9
10
# File 'lib/manhattan.rb', line 8

def status_column_value
  self.send(self.class.status_column_name)
end

#status_value(status) ⇒ Object



12
13
14
# File 'lib/manhattan.rb', line 12

def status_value(status)
  self.class.status(status)
end

#status_write_methodObject



20
21
22
# File 'lib/manhattan.rb', line 20

def status_write_method
  "#{self.class.status_column_name}="
end

#statusesObject



16
17
18
# File 'lib/manhattan.rb', line 16

def statuses
  self.class.statuses
end