Sha256: 55273ef3738e267c93028de336f0038d53086b043d5c67a6521ec49410a330e4
Contents?: true
Size: 848 Bytes
Versions: 19
Compression:
Stored size: 848 Bytes
Contents
module Puffer module Extensions 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 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
19 entries across 19 versions & 1 rubygems