Sha256: 63733cd2786252f59d8cc1b8370d2a7f8d6e88edd142ef7d392a40fd088b746d
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
module Puffer module Extensions module Object def call_chain chain swallow_nil{instance_eval(chain.to_s)} end end module String def singular? self.singularize == self end def plural? self.pluralize == self end end module Symbol def singular? to_s.singular? end def plural? to_s.plural? end end module Array def to_includes map do |field| sections = field.split('.').map(&:to_sym) hash = sections.pop sections.reverse_each do |section| hash = {section => hash} end hash end end end end end Object.send :include, Puffer::Extensions::Object String.send :include, Puffer::Extensions::String Symbol.send :include, Puffer::Extensions::Symbol Array.send :include, Puffer::Extensions::Array Kernel.class_eval do def swallow_nil yield rescue NoMethodError nil end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.0.29 | lib/puffer/extensions/core.rb |
puffer-0.0.28 | lib/puffer/extensions/core.rb |