Class: Amigo::Variables
- Includes:
- Hamster::Immutable
- Defined in:
- lib/amigo/variables.rb
Defined Under Namespace
Modules: ALL
Class Method Summary collapse
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
- #include?(name) ⇒ Boolean
-
#initialize(names) ⇒ Variables
constructor
A new instance of Variables.
- #map(row) ⇒ Object
- #to_sparql ⇒ Object
Constructor Details
#initialize(names) ⇒ Variables
Returns a new instance of Variables.
31 32 33 |
# File 'lib/amigo/variables.rb', line 31 def initialize(names) @names = Hamster.list(*names) end |
Class Method Details
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
47 48 49 50 51 |
# File 'lib/amigo/variables.rb', line 47 def eql?(other) return true if other.equal?(self) other.class.equal?(self.class) && @names.eql?(other.instance_variable_get(:@names)) end |
#hash ⇒ Object
54 55 56 |
# File 'lib/amigo/variables.rb', line 54 def hash @names.hash end |
#include?(name) ⇒ Boolean
35 36 37 |
# File 'lib/amigo/variables.rb', line 35 def include?(name) @names.include?(name) end |
#map(row) ⇒ Object
39 40 41 |
# File 'lib/amigo/variables.rb', line 39 def map(row) @names.map { |name| row[name] } end |
#to_sparql ⇒ Object
43 44 45 |
# File 'lib/amigo/variables.rb', line 43 def to_sparql @names.map { |name| "?#{name}" }.join(" ") end |