Class: Suricate::CounterWidgetResponse
Defined Under Namespace
Classes: NotAnNumberError
Instance Method Summary
collapse
#alert!, #ok!, #warning!
Constructor Details
5
6
7
8
|
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 5
def initialize
@value = nil
super
end
|
Instance Method Details
#to_h ⇒ Object
15
16
17
18
19
|
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 15
def to_h
super.tap do |hash|
hash.merge!(value: @value)
end
end
|
#value(value) ⇒ Object
10
11
12
13
|
# File 'lib/suricate/widgets/responses/counter_widget_response.rb', line 10
def value(value)
raise NotAnNumberError.new("#{value} is not a number") unless value.is_a?(Numeric)
@value = value
end
|