Class: CouponItem

Inherits:
Object
  • Object
show all
Defined in:
lib/order_review.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item) ⇒ CouponItem

Returns a new instance of CouponItem.



92
93
94
95
# File 'lib/order_review.rb', line 92

def initialize(item)
  self.name = item.css(".useCoupon_coupons_name").text.strip.gsub(/\s+/, " ").sub("\\", "¥")
  self.value = item.css("dd span").text.strip
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



90
91
92
# File 'lib/order_review.rb', line 90

def name
  @name
end

#valueObject

Returns the value of attribute value.



90
91
92
# File 'lib/order_review.rb', line 90

def value
  @value
end

Instance Method Details

#to_sObject



97
98
99
# File 'lib/order_review.rb', line 97

def to_s
  "  #{name} #{value.colorize(:green)}"
end