Module: Coneco::InitHelper
- Included in:
- Category, ConeClick, Page, Product, Purchase, Rating, ResponseHeader, Review, ReviewItem, Specification
- Defined in:
- lib/coneco/client.rb
Instance Method Summary collapse
Instance Method Details
#_to_ivar_name(s) ⇒ Object
40 41 42 43 44 |
# File 'lib/coneco/client.rb', line 40 def _to_ivar_name(s) s = s.gsub(/.[A-Z]/) {|c| c[0..0] + '_' + c[1..1].downcase } s[0..0] = s[0..0].downcase s end |
#populate(h) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/coneco/client.rb', line 33 def populate(h) h.each do |k,v| v = CGI.unescapeHTML(v) if String === v instance_variable_set('@' + _to_ivar_name(k), v) end end |