Fey::Meta::Attribute::FromInflator - An attribute metaclass for attributes with an inflator


Fey-ORM documentation Contained in the Fey-ORM distribution.

Index


Code Index:

NAME

Top

Fey::Meta::Attribute::FromInflator - An attribute metaclass for attributes with an inflator

VERSION

Top

version 0.43

SYNOPSIS

Top

  package MyApp::Song;

  has_table( $schema->table('Song') );

  for my $attr ( grep { $_->can('raw_attribute') } $self->meta()->get_all_attributes )
  {
      ...
  }

DESCRIPTION

Top

This attribute metaclass is used when Fey::ORM::Table creates attributes based on an inflator transform.

METHODS

Top

This class adds a two methods to those provided by Moose::Meta::Attribute:

$attr->raw_attribute()

Returns the attribute for the raw version of this data. This is the original attribute created for the column, which was renamed when the inflator was declared.

$attr->column()

Returns the Fey::Column object associated with the raw attribute.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


Fey-ORM documentation Contained in the Fey-ORM distribution.

package Fey::Meta::Attribute::FromInflator;
BEGIN {
  $Fey::Meta::Attribute::FromInflator::VERSION = '0.43';
}

use strict;
use warnings;
use namespace::autoclean;

use Fey::ORM::Types qw( CodeRef );

use Moose;

extends 'Moose::Meta::Attribute';

has 'inflator' => (
    is       => 'ro',
    isa      => CodeRef,
    required => 1,
);

has 'raw_attribute' => (
    is       => 'ro',
    isa      => 'Fey::Meta::Attribute::FromColumn',
    required => 1,
);

sub column {
    return $_[0]->raw_attribute()->column();
}

# The parent class's constructor is not a Moose::Object-based
# constructor, so we don't want to inline one that is.
__PACKAGE__->meta()->make_immutable( inline_constructor => 0 );

1;

# ABSTRACT: An attribute metaclass for attributes with an inflator




__END__