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
25 26 27 28 29 |
# File 'lib/watobo/http/cookies/cookies.rb', line 25 def each(&block) @cookies.each_value do || yield if block_given? end end |
#has_parm?(parm_name) ⇒ Boolean
36 37 38 |
# File 'lib/watobo/http/cookies/cookies.rb', line 36 def has_parm?(parm_name) false end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/watobo/http/cookies/cookies.rb', line 13 def inspect self.to_a end |
#parameters(&block) ⇒ Object
def
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/watobo/http/cookies/cookies.rb', line 42 def parameters(&block) params = [] do |cprefs| = Watobo::CookieParameter.new(cprefs) yield if block_given? params << end params end |
#set(parm) ⇒ Object
31 32 33 34 |
# File 'lib/watobo/http/cookies/cookies.rb', line 31 def set(parm) @cookies[parm.name.to_sym] = parm @root.set_header("Cookie", self.to_s) end |
#to_a ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/watobo/http/cookies/cookies.rb', line 17 def to_a = [] do |c| << Watobo::Cookie.new(c) end end |
#to_s ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/watobo/http/cookies/cookies.rb', line 5 def to_s s = [] @cookies.each_value do |v| s << "#{v.name}=#{v.value}" end s.join("; ") end |