Sha256: 196a75aa4efbcfbaf05a6e5a4eec6864140f6d600d0dc5867bee07814bdc3c26

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 Bytes

Contents

class PapermillException < Exception; end

module HashExtensions
  def deep_merge(hash)
    target = dup
    hash.keys.each do |key|
      if hash[key].is_a? Hash and self[key].is_a? Hash
        target[key] = target[key].deep_merge(hash[key])
        next
      end
      target[key] = hash[key]
    end
    target
  end
end
module StringExtensions
  def simple_sql_sanitizer
    gsub(/\\/, '\&\&').gsub(/'/, "''")
  end
end

module ObjectExtensions
  # Nil if empty.
  def nie
    self.blank? ? nil : self
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
papermill-0.10.0 lib/core_extensions.rb
papermill-0.9.0 lib/core_extensions.rb
papermill-0.8.0 lib/core_extensions.rb