tuliren / int_time

A value class for integer time representation

Home Page:https://rubygems.org/gems/int_time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Int Time

Build Status Gem Version

Overview

This gem provides a value class, IntTime, that represents a 24-hour format time.

Installation

gem 'int_time'

Examples

Load IntTime

require 'int_time'

Create an IntTime object

# from integer
IntTime.from(1435)
# => #<IntTime @hour=14, @minute=35>

# from string
IntTime.from("14:35")
# => #<IntTime @hour=14, @minute=35>

Convert between integer and string

IntTime.to_str(1435)
# => 14:35

IntTime.to_int("14:35")
# => 1435

About

A value class for integer time representation

https://rubygems.org/gems/int_time

License:MIT License


Languages

Language:Ruby 100.0%