Sha256: 1d6e10e896f4e20a04f0b54d60746f24256ecb4de7a3f7e084b58c7b808b45da

Contents?: true

Size: 723 Bytes

Versions: 6

Compression:

Stored size: 723 Bytes

Contents

module Fortnox
  module API
    module Types
      module Sized
        module String
          def self.[]( size )
            Types::Strict::String.constrained( max_size: size ).optional.constructor{ |value| value.to_s unless value.nil? }
          end
        end

        module Integer
          def self.[]( low, high )
            Types::Strict::Int.constrained( gteq: low, lteq: high ).optional.constructor{ |value| value.to_i unless value.nil? }
          end
        end

        module Float
          def self.[]( low, high )
            Types::Strict::Float.constrained( gteq: low, lteq: high ).optional.constructor{ |value| value.to_f unless value.nil? }
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 lib/fortnox/api/types/sized.rb
fortnox-api-0.5.1 lib/fortnox/api/types/sized.rb
fortnox-api-0.5.0 lib/fortnox/api/types/sized.rb
fortnox-api-0.4.0 lib/fortnox/api/types/sized.rb
fortnox-api-0.3.0 lib/fortnox/api/types/sized.rb
fortnox-api-0.2.0 lib/fortnox/api/types/sized.rb