Class: TextRazor::Topic
- Inherits:
-
Object
- Object
- TextRazor::Topic
- Extended by:
- Util
- Defined in:
- lib/textrazor/topic.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#wiki_link ⇒ Object
readonly
Returns the value of attribute wiki_link.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Topic
constructor
A new instance of Topic.
Methods included from Util
Constructor Details
#initialize(params = {}) ⇒ Topic
Returns a new instance of Topic.
9 10 11 12 13 |
# File 'lib/textrazor/topic.rb', line 9 def initialize(params = {}) params.each do |k, v| instance_variable_set(:"@#{k}", v) if v && self.respond_to?(:"#{k}") end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/textrazor/topic.rb', line 7 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/textrazor/topic.rb', line 7 def label @label end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
7 8 9 |
# File 'lib/textrazor/topic.rb', line 7 def score @score end |
#wiki_link ⇒ Object (readonly)
Returns the value of attribute wiki_link.
7 8 9 |
# File 'lib/textrazor/topic.rb', line 7 def wiki_link @wiki_link end |
Class Method Details
.create_from_hash(params) ⇒ Object
15 16 17 18 |
# File 'lib/textrazor/topic.rb', line 15 def self.create_from_hash(params) params = Hash[params.map {|k, v| [standardize(k), v] }] new(params) end |