Changeset 91 in bookmarks for trunk/lib


Ignore:
Timestamp:
06/05/15 19:32:33 (9 years ago)
Author:
peter
Message:

change TO_JSON() method name to to_hashref() to emphasize its multiple uses

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Bookmark.pm

    r75 r91  
    3232} 
    3333 
    34 sub TO_JSON { 
     34sub to_hashref { 
    3535    my $self = shift; 
    3636    return { 
  • trunk/lib/Bookmarks/Controller.pm

    r88 r91  
    143143         
    144144        if ($format eq 'json') { 
    145             my $json = decode_utf8(JSON->new->utf8->convert_blessed->encode($bookmark)); 
     145            my $json = decode_utf8(JSON->new->utf8->convert_blessed->encode($bookmark->to_hashref)); 
    146146            return [200, ['Content-Type' => 'application/json; charset=UTF-8', 'Last-Modified' => $last_modified], [$json]]; 
    147147        } else { 
  • trunk/lib/Bookmarks/List.pm

    r88 r91  
    9797    my $json = decode_utf8( 
    9898        JSON->new->utf8->convert_blessed->encode({ 
    99             bookmarks => $self->results, 
     99            bookmarks => [ map { $_->to_hashref } @{ $self->results } ], 
    100100        }) 
    101101    ); 
Note: See TracChangeset for help on using the changeset viewer.