Class: Spidy::Binder::Base
- Inherits:
-
Object
- Object
- Spidy::Binder::Base
- Defined in:
- lib/spidy/binder.rb
Class Attribute Summary collapse
-
.attribute_names ⇒ Object
readonly
Returns the value of attribute attribute_names.
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(define_name, spidy, resource, url) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(define_name, spidy, resource, url) ⇒ Base
Returns a new instance of Base.
33 34 35 36 37 38 |
# File 'lib/spidy/binder.rb', line 33 def initialize(define_name, spidy, resource, url) @define_name = define_name @spidy = spidy @resource = resource @url = url end |
Class Attribute Details
.attribute_names ⇒ Object (readonly)
Returns the value of attribute attribute_names.
28 29 30 |
# File 'lib/spidy/binder.rb', line 28 def attribute_names @attribute_names end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
31 32 33 |
# File 'lib/spidy/binder.rb', line 31 def resource @resource end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
31 32 33 |
# File 'lib/spidy/binder.rb', line 31 def url @url end |
Instance Method Details
#to_h ⇒ Object
44 45 46 |
# File 'lib/spidy/binder.rb', line 44 def to_h self.class.attribute_names.map { |name| [name, send(name)] }.to_h end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/spidy/binder.rb', line 40 def to_s to_h.to_json end |