Class: TSAdmin::TrafficServer::RemapEntry
- Inherits:
-
Object
- Object
- TSAdmin::TrafficServer::RemapEntry
- Defined in:
- lib/ts-admin/traffic_server.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#id ⇒ Object
Returns the value of attribute id.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(ts, type, from, to) ⇒ RemapEntry
constructor
A new instance of RemapEntry.
- #valid? ⇒ Boolean
Constructor Details
#initialize(ts, type, from, to) ⇒ RemapEntry
Returns a new instance of RemapEntry.
28 29 30 31 32 33 34 |
# File 'lib/ts-admin/traffic_server.rb', line 28 def initialize(ts, type, from, to) @ts = ts @type = type.to_sym @from = from.downcase @to = to.downcase @id = Digest::SHA1.hexdigest(@from) end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
26 27 28 |
# File 'lib/ts-admin/traffic_server.rb', line 26 def from @from end |
#id ⇒ Object
Returns the value of attribute id.
26 27 28 |
# File 'lib/ts-admin/traffic_server.rb', line 26 def id @id end |
#to ⇒ Object
Returns the value of attribute to.
26 27 28 |
# File 'lib/ts-admin/traffic_server.rb', line 26 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
26 27 28 |
# File 'lib/ts-admin/traffic_server.rb', line 26 def type @type end |
Instance Method Details
#errors ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/ts-admin/traffic_server.rb', line 40 def errors e = [] e << :type_invalid unless [:map, :redirect].include?(@type) e << :from_invalid unless valid_url?(@from) e << :to_invalid unless valid_url?(@to) e << :duplicate_entry unless @ts.remap_entries.get_from(@from).select{|e| e != self}.count == 0 e.compact.uniq end |
#valid? ⇒ Boolean
36 37 38 |
# File 'lib/ts-admin/traffic_server.rb', line 36 def valid? errors.count == 0 end |