Skip to content

Commit

Permalink
- Fixed a minor bug realted to string conversion of various objects.
Browse files Browse the repository at this point in the history
Objects that have the string context overloaded, are now correctly strigified when the `.to_s` method is called.
  • Loading branch information
trizen committed Jul 10, 2015
1 parent 8f6c8b3 commit 814ae15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Sidef/Convert/Convert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ package Sidef::Convert::Convert {
use 5.014;
our @ISA = qw(Sidef);

use overload;

sub to_s {
my ($self) = @_;
$self->isa('SCALAR') || $self->isa('REF')
? Sidef::Types::String::String->new(defined($$self) ? "$$self" : "")
$self->isa('SCALAR')
|| $self->isa('REF')
? Sidef::Types::String::String->new(overload::StrVal($self) ? "$self" : defined($$self) ? "$$self" : "")
: $self;
}

Expand Down

0 comments on commit 814ae15

Please sign in to comment.