Skip to content

Instantly share code, notes, and snippets.

@earino
Created February 28, 2014 05:47
Show Gist options
  • Save earino/9265962 to your computer and use it in GitHub Desktop.
Save earino/9265962 to your computer and use it in GitHub Desktop.
syntax highlighted version
package LedgerSMB::Currency;
use Moose;
with 'LedgerSMB::PGOSimple::Role', 'LedgerSMB::MooseTypes';
use PGObject::Util::DBMethod;
sub _set_prefix { 'currency__' }
has id => (is => 'rw', isa => 'Int', required => '0');
has symbol => (is => 'ro', isa => 'Str', required => '1');
has allowed_variance => (is => 'rw', isa => 'LedgerSMB::Moose::Number',
coerce => 1, required => 1);
has display_precision => (is => 'rw', isa => 'Int', required => '0');
has is_default => (is => 'ro', isa => 'Bool', required => '0');
dbmethod list => (funcname => 'list', returns_objects => 1 );
dbmethod save => (funcname => 'save', merge_back => 1);
dbmethod get => (funcname => 'get', returns_objects => 1,
arg_list => ['symbol']);
dbmethod get_by_id => (funcname => 'get_by_id', returns_objects => 1,
arg_list => ['id']);
__PACKAGE__->meta->make_immutable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment