blob: 16df48fd567e006e21f34e74831613092f459b51 (
plain)
1
2
3
4
5
6
7
8
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
|
class AccessLinkPair
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :from_access_point, :to_access_point
validates_presence_of :from_access_point, :to_access_point
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
def access_point
return nil if from_access_point.nil?
from_access_point.access_point
end
def stop_area
return nil if from_access_point.nil?
from_access_point.stop_area
end
def in_valid?
access_point.access_point_type != "out"
end
def out_valid?
access_point.access_point_type != "in"
end
def in_exists?
!from_access_point.id.nil?
end
def out_exists?
!to_access_point.id.nil?
end
end
|