active_model_serializers/ActiveModel/Serializer/Attribute.html
2016-06-16 09:05:14 -05:00

167 lines
5.7 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: ActiveModel::Serializer::Attribute
&mdash; Documentation by YARD 0.8.7.6
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../../';
framesUrl = "../../frames.html#!ActiveModel/Serializer/Attribute.html";
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (A)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../ActiveModel.html" title="ActiveModel (module)">ActiveModel</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Serializer.html" title="ActiveModel::Serializer (class)">Serializer</a></span></span>
&raquo;
<span class="title">Attribute</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: ActiveModel::Serializer::Attribute
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName"><span class='object_link'><a href="Field.html" title="ActiveModel::Serializer::Field (class)">Field</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Struct</li>
<li class="next"><span class='object_link'><a href="Field.html" title="ActiveModel::Serializer::Field (class)">Field</a></span></li>
<li class="next">ActiveModel::Serializer::Attribute</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">lib/active_model/serializer/attribute.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Holds all the meta-data about an attribute as it was specified in the
ActiveModel::Serializer class.</p>
</div>
</div>
<div class="tags">
<div class="examples">
<p class="tag_title">Examples:</p>
<pre class="example code"><code><span class='kw'>class</span> <span class='const'>PostSerializer</span> <span class='op'>&lt;</span> <span class='const'>ActiveModel</span><span class='op'>::</span><span class='const'>Serializer</span>
<span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:content</span>
<span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>key:</span> <span class='symbol'>:title</span>
<span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:email</span><span class='comma'>,</span> <span class='label'>key:</span> <span class='symbol'>:author_email</span><span class='comma'>,</span> <span class='label'>if:</span> <span class='symbol'>:user_logged_in?</span>
<span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:preview</span> <span class='kw'>do</span>
<span class='id identifier rubyid_truncate'>truncate</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>def</span> <span class='id identifier rubyid_user_logged_in?'>user_logged_in?</span>
<span class='id identifier rubyid_current_user'>current_user</span><span class='period'>.</span><span class='id identifier rubyid_logged_in?'>logged_in?</span>
<span class='kw'>end</span>
<span class='kw'>end</span></code></pre>
</div>
</div>
<h2>Instance Attribute Summary</h2>
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Field.html" title="ActiveModel::Serializer::Field (class)">Field</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Field.html#block-instance_method" title="ActiveModel::Serializer::Field#block (method)">#block</a></span>, <span class='object_link'><a href="Field.html#name-instance_method" title="ActiveModel::Serializer::Field#name (method)">#name</a></span>, <span class='object_link'><a href="Field.html#options-instance_method" title="ActiveModel::Serializer::Field#options (method)">#options</a></span></p>
</div>
<div id="footer">
Generated on Thu Jun 16 09:05:11 2016 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.7.6 (ruby-2.2.4).
</div>
</body>
</html>