Class: Ferret::Lexical_Ruleset

Inherits:
Object
  • Object
show all
Defined in:
lib/sql-ferret.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(simple: [], intertoken: [], multichar: []) ⇒ Lexical_Ruleset

Returns a new instance of Lexical_Ruleset.



730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/sql-ferret.rb', line 730

def initialize simple: [],
    intertoken: [],
    multichar: []

  raise 'duck type mismatch' \
      unless intertoken.respond_to? :include?
  raise 'duck type mismatch' \
      unless simple.respond_to? :include?
  raise 'duck type mismatch' \
      unless multichar.respond_to? :include?
  super()
  @intertoken = intertoken
  @simple = simple
  @multichar = multichar
  return
end

Instance Attribute Details

#multicharObject (readonly)

Returns the value of attribute multichar.



728
729
730
# File 'lib/sql-ferret.rb', line 728

def multichar
  @multichar
end

Instance Method Details

#id_continuer?(c) ⇒ Boolean

Returns:

  • (Boolean)


760
761
762
763
# File 'lib/sql-ferret.rb', line 760

def id_continuer? c
  return [(?A .. ?Z), (?a .. ?z), (?0 .. ?9), [?_]].
      any?{|s| s.include? c}
end

#id_starter?(c) ⇒ Boolean

Returns:

  • (Boolean)


755
756
757
758
# File 'lib/sql-ferret.rb', line 755

def id_starter? c
  return [(?A .. ?Z), (?a .. ?z), [?_]].
      any?{|s| s.include? c}
end

#intertoken?(c) ⇒ Boolean

Returns:

  • (Boolean)


747
748
749
# File 'lib/sql-ferret.rb', line 747

def intertoken? c
  return @intertoken.include? c
end

#simple_particle?(c) ⇒ Boolean

Returns:

  • (Boolean)


751
752
753
# File 'lib/sql-ferret.rb', line 751

def simple_particle? c
  return @simple.include? c
end