Class: Suricate::CounterWidgetResponse
- Inherits:
-
Object
- Object
- Suricate::CounterWidgetResponse
- Defined in:
- lib/suricate/widgets/responses/counter_widget_response.rb
Defined Under Namespace
Classes: NotAnNumberError
Instance Method Summary collapse
-
#initialize ⇒ CounterWidgetResponse
constructor
A new instance of CounterWidgetResponse.
- #to_h ⇒ Object
- #value(value) ⇒ Object
Constructor Details
#initialize ⇒ CounterWidgetResponse
Returns a new instance of CounterWidgetResponse.
5 6 7 |
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 5 def initialize @value = nil end |
Instance Method Details
#to_h ⇒ Object
14 15 16 |
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 14 def to_h { value: @value } end |
#value(value) ⇒ Object
9 10 11 12 |
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 9 def value(value) raise NotAnNumberError.new("#{value} is not a number") unless value.is_a?(Numeric) @value = value end |