Class: TextRazor::Relation
- Inherits:
-
Object
- Object
- TextRazor::Relation
- Defined in:
- lib/textrazor/relation.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#relation_params ⇒ Object
readonly
Returns the value of attribute relation_params.
-
#word_positions ⇒ Object
readonly
Returns the value of attribute word_positions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Relation
constructor
A new instance of Relation.
- #number_of_relation_params ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Relation
Returns a new instance of Relation.
7 8 9 10 11 12 13 |
# File 'lib/textrazor/relation.rb', line 7 def initialize(params = {}) @id = params[:id] @word_positions = params[:wordPositions] @relation_params = params[:params].map do |relation_param_hash| RelationParam.create_from_hash(relation_param_hash) end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/textrazor/relation.rb', line 5 def id @id end |
#relation_params ⇒ Object (readonly)
Returns the value of attribute relation_params.
5 6 7 |
# File 'lib/textrazor/relation.rb', line 5 def relation_params @relation_params end |
#word_positions ⇒ Object (readonly)
Returns the value of attribute word_positions.
5 6 7 |
# File 'lib/textrazor/relation.rb', line 5 def word_positions @word_positions end |
Class Method Details
.create_from_hash(params) ⇒ Object
19 20 21 |
# File 'lib/textrazor/relation.rb', line 19 def self.create_from_hash(params) new(params) end |
Instance Method Details
#number_of_relation_params ⇒ Object
15 16 17 |
# File 'lib/textrazor/relation.rb', line 15 def number_of_relation_params @relation_params.size end |