Class: TextRazor::Property
- Inherits:
-
Object
- Object
- TextRazor::Property
- Extended by:
- Util
- Defined in:
- lib/textrazor/property.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#property_positions ⇒ Object
readonly
Returns the value of attribute property_positions.
-
#word_positions ⇒ Object
readonly
Returns the value of attribute word_positions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Property
constructor
A new instance of Property.
Methods included from Util
Constructor Details
#initialize(params = {}) ⇒ Property
Returns a new instance of Property.
9 10 11 12 13 |
# File 'lib/textrazor/property.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/property.rb', line 7 def id @id end |
#property_positions ⇒ Object (readonly)
Returns the value of attribute property_positions.
7 8 9 |
# File 'lib/textrazor/property.rb', line 7 def property_positions @property_positions end |
#word_positions ⇒ Object (readonly)
Returns the value of attribute word_positions.
7 8 9 |
# File 'lib/textrazor/property.rb', line 7 def word_positions @word_positions end |
Class Method Details
.create_from_hash(params) ⇒ Object
15 16 17 18 |
# File 'lib/textrazor/property.rb', line 15 def self.create_from_hash(params) params = Hash[params.map {|k, v| [standardize(k), v] }] new(params) end |