Class: TSAdmin::TrafficServer::ValidatingArray

Inherits:
Array
  • Object
show all
Defined in:
lib/ts-admin/traffic_server.rb

Defined Under Namespace

Classes: InvalidObject

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/ts-admin/traffic_server.rb', line 16

def method_missing(m, *args, &block)
  if m.to_s =~ /^get_(\w+)$/ && args.count == 1
    select{|i| i.respond_to?($1) && i.send($1) == args[0]}
  else
    super
  end
end

Instance Method Details

#add(o) ⇒ Object

Raises:



12
13
14
15
# File 'lib/ts-admin/traffic_server.rb', line 12

def add(o)
  raise InvalidObject unless o.respond_to?(:valid?) && o.valid?
  super
end