Class: Vend::Scope
- Inherits:
-
Object
- Object
- Vend::Scope
- Defined in:
- lib/vend/scope.rb
Constant Summary collapse
- DATETIME_FORMAT =
"%Y-%m-%d %H:%M:%S"
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #escaped_value ⇒ Object
-
#initialize(name, value) ⇒ Scope
constructor
A new instance of Scope.
- #to_s ⇒ Object
Constructor Details
#initialize(name, value) ⇒ Scope
Returns a new instance of Scope.
8 9 10 11 |
# File 'lib/vend/scope.rb', line 8 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/vend/scope.rb', line 3 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/vend/scope.rb', line 4 def value @value end |
Instance Method Details
#escaped_value ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/vend/scope.rb', line 13 def escaped_value if value.instance_of? Time result = value.strftime(DATETIME_FORMAT) else result = value.to_s end CGI.escape(result) end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/vend/scope.rb', line 22 def to_s "/%s/%s" % [name, escaped_value] end |