Bubblegum
view release on metacpan or search on metacpan
lib/Bubblegum/Object/Integer.pm view on Meta::CPAN
# ABSTRACT: Common Methods for Operating on Integers
package Bubblegum::Object::Integer;
use 5.10.0;
use namespace::autoclean;
use Bubblegum::Class 'with';
use Bubblegum::Constraints -isas, -types;
with 'Bubblegum::Object::Role::Defined';
with 'Bubblegum::Object::Role::Comparison';
with 'Bubblegum::Object::Role::Value';
our @ISA = (); # non-object
our $VERSION = '0.45'; # VERSION
sub downto {
my $self = CORE::shift;
my $other = type_number CORE::shift;
return [CORE::reverse $other..$self];
}
sub eq {
my $self = CORE::shift;
my $other = type_number CORE::shift;
return $self == $other ? 1 : 0;
}
sub eqtv {
my $self = CORE::shift;
my $other = CORE::shift;
return 0 if !CORE::defined $other;
return ($self->type eq $other->type && $self == $other) ? 1 : 0;
}
sub format {
my $self = CORE::shift;
my $format = type_string CORE::shift;
return CORE::sprintf $format, $self;
}
sub gt {
my $self = CORE::shift;
my $other = type_number CORE::shift;
return $self > $other ? 1 : 0;
}
sub gte {
my $self = CORE::shift;
my $other = type_number CORE::shift;
return $self >= $other ? 1 : 0;
}
sub lt {
my $self = CORE::shift;
my $other = type_number CORE::shift;
return $self < $other ? 1 : 0;
( run in 0.743 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )