Sha256: 101408b8f0b7efed79eb76766d117afba00f700ce459fbcad277781af80dcb7b

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

require 'date'

module Trailblazer
  class Finder
    # Helper module
    module Utils
      class Parse
        # Need a replacement for this
        def self.date(value)
          return unless valid_date(value)
          Date.parse(value).strftime('%Y-%m-%d')
        end

        def self.valid_date(date)
          date_hash = Date._parse(date.to_s)
          Date.valid_date?(date_hash[:year].to_i, date_hash[:mon].to_i, date_hash[:mday].to_i)
        end

        def self.term(value)
          "%#{value.gsub(/\s+/, '%')}%"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trailblazer-finder-0.1.4 lib/trailblazer/finder/utils/parse.rb
trailblazer-finder-0.1.3 lib/trailblazer/finder/utils/parse.rb