From: Arthur Axel "fREW" Schmidt Date: Thu, 15 Apr 2010 14:14:28 +0000 (+0000) Subject: method and arg rename X-Git-Tag: v0.08122~72^2~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d7d38bef89def12f80ec81d8baede83de6913cd5;p=dbsrgits%2FDBIx-Class.git method and arg rename --- diff --git a/lib/DBIx/Class/FilterColumn.pm b/lib/DBIx/Class/FilterColumn.pm index f378ed7..13125a0 100644 --- a/lib/DBIx/Class/FilterColumn.pm +++ b/lib/DBIx/Class/FilterColumn.pm @@ -16,7 +16,7 @@ sub filter_column { $self->column_info($col)->{_filter_info} = $attrs; my $acc = $self->column_info($col)->{accessor}; - $self->mk_group_accessors('value' => [ (defined $acc ? $acc : $col), $col]); + $self->mk_group_accessors(filtered_column => [ (defined $acc ? $acc : $col), $col]); return 1; } @@ -30,7 +30,7 @@ sub _column_from_storage { return $value unless exists $info->{_filter_info}; - my $filter = $info->{_filter_info}{from_storage}; + my $filter = $info->{_filter_info}{filter_from_storage}; $self->throw_exception("No inflator for $col") unless defined $filter; return $self->$filter($value); @@ -44,12 +44,12 @@ sub _column_to_storage { return $value unless exists $info->{_filter_info}; - my $unfilter = $info->{_filter_info}{to_storage}; + my $unfilter = $info->{_filter_info}{filter_to_storage}; $self->throw_exception("No unfilter for $col") unless defined $unfilter; return $self->$unfilter($value); } -sub get_value { +sub get_filtered_column { my ($self, $col) = @_; $self->throw_exception("$col is not a filtered column") @@ -63,7 +63,7 @@ sub get_value { return $self->{_filtered_column}{$col} = $self->_column_from_storage($col, $val); } -sub set_value { +sub set_filtered_column { my ($self, $col, $filtered) = @_; $self->set_column($col, $self->_column_to_storage($col, $filtered)); @@ -79,7 +79,7 @@ sub update { if ($self->has_column($key) && exists $self->column_info($key)->{_filter_info}) { my $val = delete $attrs->{$key}; - $self->set_value($key, $val); + $self->set_filtered_column($key, $val); $attrs->{$key} = $self->_column_to_storage($key, $val) } } diff --git a/t/row/filter_column.t b/t/row/filter_column.t index a3d8130..6441e33 100644 --- a/t/row/filter_column.t +++ b/t/row/filter_column.t @@ -8,8 +8,8 @@ use DBICTest; my $schema = DBICTest->init_schema(); DBICTest::Schema::Artist->load_components('FilterColumn'); DBICTest::Schema::Artist->filter_column(rank => { - from_storage => sub { $_[1] * 2 }, - to_storage => sub { $_[1] / 2 }, + filter_from_storage => sub { $_[1] * 2 }, + filter_to_storage => sub { $_[1] / 2 }, }); Class::C3->reinitialize();