[Bast-commits] r9178 - in DBIx-Class/0.08/branches/filter_column:
lib/DBIx/Class t/row
frew at dev.catalyst.perl.org
frew at dev.catalyst.perl.org
Thu Apr 15 04:34:17 GMT 2010
Author: frew
Date: 2010-04-15 05:34:16 +0100 (Thu, 15 Apr 2010)
New Revision: 9178
Modified:
DBIx-Class/0.08/branches/filter_column/lib/DBIx/Class/FilterColumn.pm
DBIx-Class/0.08/branches/filter_column/t/row/filter_column.t
Log:
better namiology
Modified: DBIx-Class/0.08/branches/filter_column/lib/DBIx/Class/FilterColumn.pm
===================================================================
--- DBIx-Class/0.08/branches/filter_column/lib/DBIx/Class/FilterColumn.pm 2010-04-14 23:41:26 UTC (rev 9177)
+++ DBIx-Class/0.08/branches/filter_column/lib/DBIx/Class/FilterColumn.pm 2010-04-15 04:34:16 UTC (rev 9178)
@@ -20,7 +20,7 @@
return 1;
}
-sub _filtered_column {
+sub _column_from_storage {
my ($self, $col, $value) = @_;
return $value unless defined $value;
@@ -30,13 +30,13 @@
return $value unless exists $info->{_filter_info};
- my $filter = $info->{_filter_info}{filter};
+ my $filter = $info->{_filter_info}{from_storage};
$self->throw_exception("No inflator for $col") unless defined $filter;
return $self->$filter($value);
}
-sub _unfiltered_column {
+sub _column_to_storage {
my ($self, $col, $value) = @_;
my $info = $self->column_info($col) or
@@ -44,7 +44,7 @@
return $value unless exists $info->{_filter_info};
- my $unfilter = $info->{_filter_info}{unfilter};
+ my $unfilter = $info->{_filter_info}{to_storage};
$self->throw_exception("No unfilter for $col") unless defined $unfilter;
return $self->$unfilter($value);
}
@@ -60,13 +60,13 @@
my $val = $self->get_column($col);
- return $self->{_filtered_column}{$col} = $self->_filtered_column($col, $val);
+ return $self->{_filtered_column}{$col} = $self->_column_from_storage($col, $val);
}
sub set_value {
my ($self, $col, $filtered) = @_;
- $self->set_column($col, $self->_unfiltered_column($col, $filtered));
+ $self->set_column($col, $self->_column_to_storage($col, $filtered));
delete $self->{_filtered_column}{$col};
@@ -80,7 +80,7 @@
exists $self->column_info($key)->{_filter_info}) {
my $val = delete $attrs->{$key};
$self->set_value($key, $val);
- $attrs->{$key} = $self->_unfiltered_column($key, $val)
+ $attrs->{$key} = $self->_column_to_storage($key, $val)
}
}
return $self->next::method($attrs, @rest);
@@ -92,7 +92,7 @@
foreach my $key (keys %{$attrs||{}}) {
if ($class->has_column($key) &&
exists $class->column_info($key)->{_filter_info} ) {
- $attrs->{$key} = $class->_unfiltered_column($key, delete $attrs->{$key})
+ $attrs->{$key} = $class->_column_to_storage($key, delete $attrs->{$key})
}
}
my $obj = $class->next::method($attrs, @rest);
Modified: DBIx-Class/0.08/branches/filter_column/t/row/filter_column.t
===================================================================
--- DBIx-Class/0.08/branches/filter_column/t/row/filter_column.t 2010-04-14 23:41:26 UTC (rev 9177)
+++ DBIx-Class/0.08/branches/filter_column/t/row/filter_column.t 2010-04-15 04:34:16 UTC (rev 9178)
@@ -8,8 +8,8 @@
my $schema = DBICTest->init_schema();
DBICTest::Schema::Artist->load_components('FilterColumn');
DBICTest::Schema::Artist->filter_column(rank => {
- filter => sub { $_[1] * 2 },
- unfilter => sub { $_[1] / 2 },
+ from_storage => sub { $_[1] * 2 },
+ to_storage => sub { $_[1] / 2 },
});
Class::C3->reinitialize();
More information about the Bast-commits
mailing list