class ProMotion::FormStyle
Public Class Methods
new(obj=nil)
click to toggle source
# File lib/ProMotion/form/form_style.rb, line 3 def initialize(obj=nil) replace(obj) if obj.kind_of? Hash end
to_style(obj, out={}, ary=[])
click to toggle source
# File lib/ProMotion/form/form_style.rb, line 15 def self.to_style(obj, out={}, ary=[]) obj.each do |key, val| case val when Hash then next to_style(val, out, ary + [key.to_s]) when Class then val = val.new when Proc then val = val.call end all = (ary + [key.to_s]) * '.' val ? (out[all] = val) : out.delete(all) end out end
Public Instance Methods
+(obj)
click to toggle source
# File lib/ProMotion/form/form_style.rb, line 7 def +(obj) merge(obj || {}) end
<<(obj)
click to toggle source
# File lib/ProMotion/form/form_style.rb, line 11 def <<(obj) merge!(obj || {}) end