Class: Watobo::HTTP::Cookies
- Inherits:
-
Object
- Object
- Watobo::HTTP::Cookies
- Defined in:
- lib/watobo/http/cookies/cookies.rb
Defined Under Namespace
Modules: Mixin
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #has_parm?(parm_name) ⇒ Boolean
-
#initialize(root) ⇒ Cookies
constructor
A new instance of Cookies.
- #inspect ⇒ Object
-
#parameters(&block) ⇒ Object
def.
- #set(parm) ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#each(&block) ⇒ Object
47 48 49 50 51 |
# File 'lib/watobo/http/cookies/cookies.rb', line 47 def each(&block) @cookies.each_value do || yield if block_given? end end |
#has_parm?(parm_name) ⇒ Boolean
58 59 60 |
# File 'lib/watobo/http/cookies/cookies.rb', line 58 def has_parm?(parm_name) false end |
#inspect ⇒ Object
34 35 36 |
# File 'lib/watobo/http/cookies/cookies.rb', line 34 def inspect self.to_a end |
#parameters(&block) ⇒ Object
def
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/watobo/http/cookies/cookies.rb', line 64 def parameters(&block) params = [] do |cprefs| = Watobo::CookieParameter.new(cprefs) yield if block_given? params << end params end |
#set(parm) ⇒ Object
53 54 55 56 |
# File 'lib/watobo/http/cookies/cookies.rb', line 53 def set(parm) @cookies[parm.name.to_sym] = parm @root.set_header("Cookie", self.to_s) end |
#to_a ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/watobo/http/cookies/cookies.rb', line 38 def to_a = [] do |c| << Watobo::Cookie.new(c) end end |
#to_s ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/watobo/http/cookies/cookies.rb', line 26 def to_s s = [] @cookies.each_value do |v| s << "#{v.name}=#{v.value}" end s.join("; ") end |