Class: AcademicBenchmarks::Standards::HasRelations

Inherits:
Object
  • Object
show all
Includes:
InstVarsToHash
Defined in:
lib/academic_benchmarks/standards/has_relations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from InstVarsToHash

#to_h, #to_s

Constructor Details

#initialize(origin: 0, derivative: 0, related_derivative: 0) ⇒ HasRelations

Returns a new instance of HasRelations.



14
15
16
17
18
# File 'lib/academic_benchmarks/standards/has_relations.rb', line 14

def initialize(origin: 0, derivative: 0, related_derivative: 0)
  @origin = origin
  @derivative = derivative
  @related_derivative = related_derivative
end

Instance Attribute Details

#derivativeObject

Returns the value of attribute derivative.



8
9
10
# File 'lib/academic_benchmarks/standards/has_relations.rb', line 8

def derivative
  @derivative
end

#originObject

Returns the value of attribute origin.



8
9
10
# File 'lib/academic_benchmarks/standards/has_relations.rb', line 8

def origin
  @origin
end

Returns the value of attribute related_derivative.



8
9
10
# File 'lib/academic_benchmarks/standards/has_relations.rb', line 8

def related_derivative
  @related_derivative
end

Class Method Details

.from_hash(hash) ⇒ Object



10
11
12
# File 'lib/academic_benchmarks/standards/has_relations.rb', line 10

def self.from_hash(hash)
  self.new(derivative: hash["derivative"], origin: hash["origin"], related_derivative: hash["related_derivative"])
end