Navigation Menu

Skip to content

Commit

Permalink
s/SyntaxNote/Constraint/g, add a (for now informative) incomplete att…
Browse files Browse the repository at this point in the history
…ribute to segments
  • Loading branch information
sorear committed Mar 13, 2013
1 parent 72115b5 commit 0066fb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
@@ -1,4 +1,4 @@
package X12::Schema::SyntaxNote;
package X12::Schema::Constraint;

use Moose;
use namespace::autoclean;
Expand Down
5 changes: 3 additions & 2 deletions lib/X12/Schema/Segment.pm
Expand Up @@ -6,15 +6,16 @@ use namespace::autoclean;
with 'X12::Schema::Sequencable';

has tag => (isa => 'Str', is => 'ro', required => 1);
has syntax_notes => (isa => 'ArrayRef[X12::Schema::SyntaxNote]', is => 'ro', default => sub { [] });
has constraints => (isa => 'ArrayRef[X12::Schema::Constraint]', is => 'ro', default => sub { [] });
has elements => (isa => 'ArrayRef[X12::Schema::Element]', is => 'ro', required => 1);
has incomplete => (isa => 'Bool', is => 'ro', default => 0);

sub encode {
my ($self, $sink, $obj) = @_;

die 'Segment '.$self->name." must be encoded using a HASH\n" unless $obj && ref($obj) eq 'HASH' && !blessed($obj);

$_->check($obj) for @{ $self->syntax_notes };
$_->check($obj) for @{ $self->constraints };

my %tmp = %$obj;
my @bits;
Expand Down

0 comments on commit 0066fb1

Please sign in to comment.