Sha256: daba4bfe88aa27436a925de188f30452080f04aa9ecc6eb48966a3745de298b4

Contents?: true

Size: 337 Bytes

Versions: 1

Compression:

Stored size: 337 Bytes

Contents

module Suricate
  class CounterWidgetResponse
    class NotAnNumberError < StandardError; end

    def initialize
      @value = nil
    end

    def value(value)
      raise NotAnNumberError.new("#{value} is not a number") unless value.is_a?(Numeric)
      @value = value
    end

    def to_h
      { value: @value }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
suricate-0.0.2 lib/suricate/widgets/responses/counter_widget_response.rb