Module: ActiveShipping::Carriers

Extended by:
Carriers
Included in:
Carriers
Defined in:
lib/active_shipping/carriers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#registeredObject (readonly)

Returns the value of attribute registered.



5
6
7
# File 'lib/active_shipping/carriers.rb', line 5

def registered
  @registered
end

Instance Method Details

#allObject



13
14
15
# File 'lib/active_shipping/carriers.rb', line 13

def all
  ActiveShipping::Carriers.registered.map { |name| ActiveShipping.const_get(name) }
end

#find(name) ⇒ Object



17
18
19
# File 'lib/active_shipping/carriers.rb', line 17

def find(name)
  all.find { |c| c.name.downcase == name.to_s.downcase } or raise NameError, "unknown carrier #{name}"
end

#register(class_name, autoload_require) ⇒ Object



8
9
10
11
# File 'lib/active_shipping/carriers.rb', line 8

def register(class_name, autoload_require)
  ActiveShipping.autoload(class_name, autoload_require)
  self.registered << class_name
end