Module: ActiveShipping::Carriers
Instance Attribute Summary collapse
-
#registered ⇒ Object
readonly
Returns the value of attribute registered.
Instance Method Summary collapse
Instance Attribute Details
#registered ⇒ Object (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
#all ⇒ Object
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 |