Sha256: 7132f97a5d1a1d7765e2caf25e8751ded088e5932b8d5864561f1545d00b5f7b

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

# TODO: These rules should be added to a live array, not a constant one
module MagickColumns
  TOKENIZE_RULES = {
    from: {
      pattern: -> { /(\A\s*|\s+)(#{MagickColumns.from_operators})\s+(\S+)/ },
      tokenizer: ->(match) { { operator: '>=', term: match[3] } }
    },
    until:{
      pattern: -> { /(\A\s*|\s+)(#{MagickColumns.until_operators})\s+(\S+)/ },
      tokenizer: ->(match) { { operator: '<=', term: match[3] } }
    }
  }
  
  REPLACEMENT_RULES = {
    today: {
      pattern: -> { /#{MagickColumns.today_operators}/ },
      replacement: ->(match) { Date.today.to_s(:db) }
    }
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magick_columns-0.0.4 lib/magick_columns/rules.rb
magick_columns-0.0.3 lib/magick_columns/rules.rb