Method: FactoryForm::Rating#initialize
- Defined in:
- lib/factoryform/rating.rb
#initialize(options = {}) ⇒ Rating
Returns a new instance of Rating.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/factoryform/rating.rb', line 6 def initialize(={}) [:field_type] = "rating" super() # Default is 2 for number of scales if [:scale] && [:scale].to_i > 1 self.scale = [:scale].to_i else raise(ParameterExpectedException, "Missing rating scale (should be greater than or equal to 2)") end self.from_label = [:from_label] || "" self.to_label = [:to_label] || "" end |