Sha256: 0f17b5529efc30e36ca1c262ecefbe45b218850c4ebb0f7361b8a38d941702e9
Contents?: true
Size: 987 Bytes
Versions: 2
Compression:
Stored size: 987 Bytes
Contents
class Hash begin method "to_options" rescue def to_options inject(Hash.new){|h, kv| h.update kv.first.to_s.to_sym => kv.last} end def to_options! replace to_options end end begin method "to_string_options" rescue def to_string_options inject(Hash.new){|h, kv| h.update kv.first.to_s => kv.last} end def to_string_options! replace to_string_options end end end class Object begin method "returning" rescue def returning value, &block block.call value value end end end class Object def singleton_class &block tmp = @singleton_class || class << self self end block ? tmp.module_eval(&block) : tmp end end class String begin method 'underscore' rescue def underscore gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bj_fixed_for_rails3-1.0.4 | lib/bj/stdext.rb |
bj_fixed_for_rails3-1.0.3 | lib/bj/stdext.rb |