Sha256: 0c3848ebda42affe4254d1f72735be220f6dbd2cc73293f79512315c1c865ef2

Contents?: true

Size: 631 Bytes

Versions: 5

Compression:

Stored size: 631 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 StringToUrlNotFound
  def to_url
    gsub(/[^a-zA-Z0-9]/, "-").gsub(/-+/, "-").gsub(/^-|-$/, "")
  end
end
module ObjectExtensions
  # Nil if empty.
  def nie
    self.blank? ? nil : self
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
papermill-0.11.0 lib/core_extensions.rb
papermill-0.10.4 lib/core_extensions.rb
papermill-0.10.3 lib/core_extensions.rb
papermill-0.10.2 lib/core_extensions.rb
papermill-0.10.1 lib/core_extensions.rb