Class: Regin::Atom
- Inherits:
-
Object
- Object
- Regin::Atom
- Defined in:
- lib/rack/mount/vendor/regin/regin/atom.rb
Instance Attribute Summary collapse
-
#ignorecase ⇒ Object
readonly
Returns the value of attribute ignorecase.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
- #casefold? ⇒ Boolean
- #dup(options = {}) ⇒ Object
-
#eql?(other) ⇒ Boolean
:nodoc:.
-
#initialize(value, options = {}) ⇒ Atom
constructor
A new instance of Atom.
-
#inspect ⇒ Object
:nodoc:.
-
#literal? ⇒ Boolean
Returns true if expression could be treated as a literal string.
- #option_names ⇒ Object
- #to_s(parent = false) ⇒ Object
Constructor Details
#initialize(value, options = {}) ⇒ Atom
Returns a new instance of Atom.
5 6 7 8 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 5 def initialize(value, = {}) @value = value @ignorecase = [:ignorecase] end |
Instance Attribute Details
#ignorecase ⇒ Object (readonly)
Returns the value of attribute ignorecase.
3 4 5 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 3 def ignorecase @ignorecase end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 3 def value @value end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
39 40 41 42 43 44 45 46 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 39 def ==(other) #:nodoc: case other when String other == to_s else eql?(other) end end |
#casefold? ⇒ Boolean
19 20 21 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 19 def casefold? ignorecase ? true : false end |
#dup(options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 23 def dup( = {}) = option_names.inject({}) do |h, m| h[m.to_sym] = send(m) h end self.class.new(value, .merge()) end |
#eql?(other) ⇒ Boolean
:nodoc:
48 49 50 51 52 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 48 def eql?(other) #:nodoc: other.instance_of?(self.class) && self.value.eql?(other.value) && (!!self.ignorecase).eql?(!!other.ignorecase) end |
#inspect ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 35 def inspect #:nodoc: "#<#{self.class.to_s.sub('Regin::', '')} #{to_s.inspect}>" end |
#literal? ⇒ Boolean
Returns true if expression could be treated as a literal string.
15 16 17 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 15 def literal? false end |
#option_names ⇒ Object
10 11 12 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 10 def option_names %w( ignorecase ) end |
#to_s(parent = false) ⇒ Object
31 32 33 |
# File 'lib/rack/mount/vendor/regin/regin/atom.rb', line 31 def to_s(parent = false) "#{value}" end |