class SiteHub::Cookie
Constants
- FIRST
Attributes
attributes_and_flags[R]
name_attribute[R]
Public Class Methods
new(cookie_string)
click to toggle source
# File lib/sitehub/cookie.rb, line 12 def initialize(cookie_string) @attributes_and_flags = cookie_string.split(SEMICOLON).map do |entry| if entry.include?(EQUALS_SIGN) Cookie::Attribute.new(*entry.split(EQUALS_SIGN)) else Cookie::Flag.new(entry) end end name_attribute = @attributes_and_flags.delete_at(FIRST) @name_attribute = Cookie::Attribute.new(name_attribute.name.to_s, name_attribute.value) end
Public Instance Methods
find(name)
click to toggle source
# File lib/sitehub/cookie.rb, line 33 def find(name) attributes_and_flags.find { |entry| entry.name == name } end
name()
click to toggle source
# File lib/sitehub/cookie.rb, line 25 def name name_attribute.name end
to_s()
click to toggle source
# File lib/sitehub/cookie.rb, line 37 def to_s [name_attribute].concat(attributes_and_flags).join(SEMICOLON_WITH_SPACE) end
value()
click to toggle source
# File lib/sitehub/cookie.rb, line 29 def value name_attribute.value end