Class: Weary::Resource
- Inherits:
-
Object
- Object
- Weary::Resource
- Defined in:
- lib/weary/resource.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#name ⇒ Object
Returns the value of attribute name.
-
#requires ⇒ Object
Returns the value of attribute requires.
-
#url ⇒ Object
Returns the value of attribute url.
-
#via ⇒ Object
Returns the value of attribute via.
-
#with ⇒ Object
Returns the value of attribute with.
Instance Method Summary collapse
- #authenticates? ⇒ Boolean
- #follows_redirects? ⇒ Boolean
-
#initialize(name, options = {}) ⇒ Resource
constructor
A new instance of Resource.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Resource
Returns a new instance of Resource.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/weary/resource.rb', line 5 def initialize(name,={}) @domain = [:domain] self.name = name self.via = [:via] self.with = [:with] self.requires = [:requires] self.format = [:format] self.url = [:url] @authenticates = ([:authenticates] != false) @follows = ([:no_follow] == false) end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def format @format end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def name @name end |
#requires ⇒ Object
Returns the value of attribute requires.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def requires @requires end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def url @url end |
#via ⇒ Object
Returns the value of attribute via.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def via @via end |
#with ⇒ Object
Returns the value of attribute with.
3 4 5 |
# File 'lib/weary/resource.rb', line 3 def with @with end |
Instance Method Details
#authenticates? ⇒ Boolean
55 56 57 |
# File 'lib/weary/resource.rb', line 55 def authenticates? @authenticates end |
#follows_redirects? ⇒ Boolean
59 60 61 |
# File 'lib/weary/resource.rb', line 59 def follows_redirects? @follows end |
#to_hash ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/weary/resource.rb', line 63 def to_hash {@name.to_sym => {:via => @via, :with => @with, :requires => @requires, :authenticates => authenticates?, :format => @format, :url => @url}, :no_follow => !follows_redirects?} end |