Sha256: ade670bc611d549497e5464111947156fd27bfce28c53bf16532cbcb113dcb33
Contents?: true
Size: 736 Bytes
Versions: 6
Compression:
Stored size: 736 Bytes
Contents
module Captcher class Config < OpenStruct def initialize super yield(self) if block_given? end def merge(other) to_h.merge(other.to_h) end def respond_to_missing? true end def method_missing(name, *args) if block_given? branch = self.class.new yield(branch) args = [branch] end name = to_writer(name, args) super end def to_h attributes = super attributes.map do |key, value| if value.class == self.class [key, value.to_h] else [key, value] end end.to_h end def to_writer(name, args) args && (name !~ /=$/) ? "#{name}=" : name end end end
Version data entries
6 entries across 6 versions & 1 rubygems