Class: Regexp::Expression::Quantifier
  
  
  
  
  
    - Inherits:
 
    - 
      Object
      
        
          - Object
 
          
            - Regexp::Expression::Quantifier
 
          
        
        show all
      
     
  
  
  
  
  
  
  
      - Includes:
 
      - Shared
 
  
  
  
  
  
  
    - Defined in:
 
    - lib/regexp_parser/expression/quantifier.rb
 
  
  
 
Overview
  
    
TODO: in v3.0.0, maybe put Shared back into Base, and inherit from Base and call super in #initialize, but raise in #quantifier= and #quantify, or introduce an Expression::Quantifiable intermediate class. Or actually allow chaining as a more concise but tricky solution than PR#69.
   
 
  
  
    
      Constant Summary
      collapse
    
    
      
        - MODES =
          
        
 
        %i[greedy possessive reluctant]
 
      
    
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods included from Shared
  #==, #base_length, #coded_offset, #ends_at, #full_length, #human_name, included, #initialize_copy, #inspect, #is?, #nesting_level=, #offset, #one_of?, #optional?, #parts, #pre_quantifier_decoration, #pretty_print, #pretty_print_instance_variables, #quantified?, #quantifier=, #quantifier_affix, #starts_at, #to_s, #token_class, #type?
  Constructor Details
  
    
  
  
    #initialize(*args)  ⇒ Quantifier 
  
  
  
  
    
Returns a new instance of Quantifier.
   
 
  
  
    
      
11
12
13
14
15
16
17 
     | 
    
      # File 'lib/regexp_parser/expression/quantifier.rb', line 11
def initialize(*args)
  deprecated_old_init(*args) and return if args.count == 4 || args.count == 5
  init_from_token_and_options(*args)
    self.token = token.to_s.sub(/_(greedy|possessive|reluctant)/, '').to_sym
end
     | 
  
 
  
 
  
    Instance Method Details
    
      
  
  
    #max  ⇒ Object 
  
  
  
  
    
      
42
43
44 
     | 
    
      # File 'lib/regexp_parser/expression/quantifier.rb', line 42
def max
  derived_data[:max]
end 
     | 
  
 
    
      
  
  
    #min  ⇒ Object 
  
  
  
  
    
      
38
39
40 
     | 
    
      # File 'lib/regexp_parser/expression/quantifier.rb', line 38
def min
  derived_data[:min]
end 
     | 
  
 
    
      
  
  
    #mode  ⇒ Object 
  
  
  
  
    
      
46
47
48 
     | 
    
      # File 'lib/regexp_parser/expression/quantifier.rb', line 46
def mode
  derived_data[:mode]
end 
     | 
  
 
    
      
  
  
    #to_h  ⇒ Object 
  
  
  
  
    
      
19
20
21
22
23
24
25
26
27 
     | 
    
      # File 'lib/regexp_parser/expression/quantifier.rb', line 19
def to_h
  {
    token: token,
    text:  text,
    mode:  mode,
    min:   min,
    max:   max,
  }
end
     |