Class: BillingLogic::CommandBuilders::ProductList
- Inherits:
-
Object
- Object
- BillingLogic::CommandBuilders::ProductList
- Defined in:
- lib/billing_logic/command_builders/command_builders.rb
Class Method Summary collapse
-
.parse(string, options = {}) ⇒ Object
ProductList.parse returns a dumb array You can’t add behavior (I tried adding #price).
Class Method Details
.parse(string, options = {}) ⇒ Object
ProductList.parse returns a dumb array You can’t add behavior (I tried adding #price)
16 17 18 19 20 21 22 23 24 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 16 def self.parse(string, = {}) if (products = (string =~ /\(([^\(\)]*)\)/) ? $1 : nil) products.split(/ & /).map do |product_string| ProductStub.parse(product_string, ) end else [] end end |