Class: Regin::CharacterClass

### Home Classes Methods

### In Files

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

### Parent

Regin::Character

### Methods

- ::new
- #bracketed?
- #include?
- #literal?
- #negated?
- #option_names
- #to_s

### Files

- LICENSE
- README.rdoc

### 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
- Multimap
- Multiset
- NestedMultimap

No matching classes.

# Regin::CharacterClass

### Attributes

negate[R]

### Public Class Methods

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

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

### Public Instance Methods

bracketed?() click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 25
    def bracketed?
      value != '.' && value !~ /^\\[dDsSwW]$/
    end

include?(char) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 41
    def include?(char)
      re = quantifier ? to_s.sub(/#{Regexp.escape(quantifier)}$/, '') : to_s
      Regexp.compile("\\A#{re}\\Z").match(char)
    end

literal?() click to toggle source

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

A CharacterClass is never literal.

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 21
    def literal?
      false
    end

negated?() click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 14
    def negated?
      negate ? true : false
    end

option_names() click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 8
    def option_names
      %( negate ) + super
    end

to_s(parent = false) click to toggle source

    # File lib/rack/mount/vendor/regin/regin/character_class.rb, line 29
    def to_s(parent = false)
      if bracketed?
        if !parent && ignorecase
          "(?i-mx:[#{negate && '^'}#{value}])#{quantifier}"
        else
          "[#{negate && '^'}#{value}]#{quantifier}"
        end
      else
        super
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.