Class: Regin::Character

### Home Classes Methods

### In Files

- lib/rack/mount/vendor/regin/regin/character.rb

### Parent

Regin::Atom

### Methods

- ::new
- #include?
- #literal?
- #match
- #option_names
- #to_regexp
- #to_s

### Class/Module Index

Quicksearch

- Rack
- Rack::Mount
- Rack::Mount::Analysis
- Rack::Mount::Analysis::Splitting
- Rack::Mount::Analysis::Splitting::Key
- Rack::Mount::GeneratableRegexp
- Rack::Mount::GeneratableRegexp::InstanceMethods
- Rack::Mount::RegexpWithNamedGroups
- Rack::Mount::Route
- Rack::Mount::RouteSet
- Rack::Mount::RoutingError
- Rack::Mount::Strexp
- Rack::Mount::StrexpParser
- Rack::Mount::StrexpParser::ScanError
- Rack::Mount::Utils
- Regin
- Regin::Alternation
- Regin::Anchor
- Regin::Atom
- Regin::Character
- Regin::CharacterClass
- Regin::Collection
- Regin::Expression
- Regin::Group
- Regin::Options
- Regin::Parser
- Regin::Parser::ScanError

No matching classes.

# Regin::Character

### Attributes

quantifier[R]

### Public Class Methods

new(value, options = {}) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 5
    def initialize(value, options = {})
      @quantifier = options[:quantifier]
      super
    end

### Public Instance Methods

include?(char) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 39
    def include?(char)
      if ignorecase
        value.downcase == char.downcase
      else
        value == char
      end
    end

literal?() click to toggle source

Returns true if expression could be treated as a literal string.

A Character is literal is there is no quantifier attached to it.

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 17
    def literal?
      quantifier.nil? && !ignorecase
    end

match(char) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 35
    def match(char)
      to_regexp(true).match(char)
    end

option_names() click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 10
    def option_names
      %( quantifier ) + super
    end

to_regexp(anchored = false) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 29
    def to_regexp(anchored = false)
      re = to_s(true)
      re = "\\A#{re}\\Z" if anchored
      Regexp.compile(re, ignorecase)
    end

to_s(parent = false) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character.rb, line 21
    def to_s(parent = false)
      if !parent && ignorecase
        "(?i-mx:#{value})#{quantifier}"
      else
        "#{value}#{quantifier}"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.