543 lines
18 KiB
HTML
543 lines
18 KiB
HTML
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
<!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>
|
||
|
<title>EventFilter</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
|
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
|
||
|
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
|
||
|
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
|
||
|
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div class="banner">
|
||
|
|
||
|
<h1>
|
||
|
<span class="type">Class</span>
|
||
|
EventFilter
|
||
|
|
||
|
<span class="parent"><
|
||
|
|
||
|
Object
|
||
|
|
||
|
</span>
|
||
|
|
||
|
</h1>
|
||
|
<ul class="files">
|
||
|
|
||
|
<li><a href="../files/lib/event_filter_rb.html">lib/event_filter.rb</a></li>
|
||
|
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div id="bodyContent">
|
||
|
<div id="content">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Method ref -->
|
||
|
<div class="sectiontitle">Methods</div>
|
||
|
<dl class="methods">
|
||
|
|
||
|
<dt>A</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-i-active-3F">active?</a>,
|
||
|
</li>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-i-apply_filter">apply_filter</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>C</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-comments">comments</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>D</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-default_filter">default_filter</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>M</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-merged">merged</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>N</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-new">new</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>O</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-i-options">options</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>P</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-push">push</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
<dt>T</dt>
|
||
|
<dd>
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="#method-c-team">team</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Section attributes -->
|
||
|
<div class="sectiontitle">Attributes</div>
|
||
|
<table border='0' cellpadding='5'>
|
||
|
|
||
|
<tr valign='top'>
|
||
|
<td class='attr-rw'>
|
||
|
[RW]
|
||
|
</td>
|
||
|
<td class='attr-name'>params</td>
|
||
|
<td class='attr-desc'></td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
<!-- Methods -->
|
||
|
|
||
|
<div class="sectiontitle">Class Public methods</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-comments">
|
||
|
|
||
|
<b>comments</b>()
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-comments" name="method-c-comments" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-comments_source')" id="l_method-c-comments_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-comments_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 17</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">comments</span>
|
||
|
<span class="ruby-string">'comments'</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-default_filter">
|
||
|
|
||
|
<b>default_filter</b>()
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-default_filter" name="method-c-default_filter" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-default_filter_source')" id="l_method-c-default_filter_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-default_filter_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 5</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">default_filter</span>
|
||
|
<span class="ruby-node">%w{ push issues merge_requests team}</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-merged">
|
||
|
|
||
|
<b>merged</b>()
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-merged" name="method-c-merged" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-merged_source')" id="l_method-c-merged_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-merged_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 13</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">merged</span>
|
||
|
<span class="ruby-string">'merged'</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-new">
|
||
|
|
||
|
<b>new</b>(params)
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-new" name="method-c-new" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-new_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 26</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span> <span class="ruby-identifier">params</span>
|
||
|
<span class="ruby-ivar">@params</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>
|
||
|
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">dup</span>
|
||
|
<span class="ruby-keyword">else</span>
|
||
|
[]<span class="ruby-comment">#EventFilter.default_filter</span>
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-push">
|
||
|
|
||
|
<b>push</b>()
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-push" name="method-c-push" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-push_source')" id="l_method-c-push_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-push_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 9</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">push</span>
|
||
|
<span class="ruby-string">'push'</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-c-team">
|
||
|
|
||
|
<b>team</b>()
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-c-team" name="method-c-team" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-c-team_source')" id="l_method-c-team_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-c-team_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 21</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">team</span>
|
||
|
<span class="ruby-string">'team'</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="sectiontitle">Instance Public methods</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-i-active-3F">
|
||
|
|
||
|
<b>active?</b>(key)
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-i-active-3F" name="method-i-active-3F" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-i-active-3F_source')" id="l_method-i-active-3F_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-i-active-3F_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 65</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">active?</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-i-apply_filter">
|
||
|
|
||
|
<b>apply_filter</b>(events)
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-i-apply_filter" name="method-i-apply_filter" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-i-apply_filter_source')" id="l_method-i-apply_filter_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-i-apply_filter_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 34</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">apply_filter</span> <span class="ruby-identifier">events</span>
|
||
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">events</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">present?</span>
|
||
|
|
||
|
<span class="ruby-identifier">filter</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">dup</span>
|
||
|
|
||
|
<span class="ruby-identifier">actions</span> = []
|
||
|
<span class="ruby-identifier">actions</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Event</span><span class="ruby-operator">::</span><span class="ruby-constant">Pushed</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'push'</span>
|
||
|
<span class="ruby-identifier">actions</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Event</span><span class="ruby-operator">::</span><span class="ruby-constant">Merged</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'merged'</span>
|
||
|
|
||
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'team'</span>
|
||
|
<span class="ruby-identifier">actions</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Event</span><span class="ruby-operator">::</span><span class="ruby-constant">Joined</span>
|
||
|
<span class="ruby-identifier">actions</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Event</span><span class="ruby-operator">::</span><span class="ruby-constant">Left</span>
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
|
||
|
<span class="ruby-identifier">actions</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Event</span><span class="ruby-operator">::</span><span class="ruby-constant">Commented</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'comments'</span>
|
||
|
|
||
|
<span class="ruby-identifier">events</span> = <span class="ruby-identifier">events</span>.<span class="ruby-identifier">where</span>(<span class="ruby-identifier">action</span><span class="ruby-operator">:</span> <span class="ruby-identifier">actions</span>)
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="method">
|
||
|
<div class="title method-title" id="method-i-options">
|
||
|
|
||
|
<b>options</b>(key)
|
||
|
|
||
|
<a href="../classes/EventFilter.html#method-i-options" name="method-i-options" class="permalink">Link</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="description">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="sourcecode">
|
||
|
|
||
|
<p class="source-link">
|
||
|
Source:
|
||
|
<a href="javascript:toggleSource('method-i-options_source')" id="l_method-i-options_source">show</a>
|
||
|
|
||
|
</p>
|
||
|
<div id="method-i-options_source" class="dyn-source">
|
||
|
<pre><span class="ruby-comment"># File lib/event_filter.rb, line 53</span>
|
||
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">options</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-identifier">filter</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">dup</span>
|
||
|
|
||
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-identifier">filter</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-keyword">else</span>
|
||
|
<span class="ruby-identifier">filter</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key</span>
|
||
|
<span class="ruby-keyword">end</span>
|
||
|
|
||
|
<span class="ruby-identifier">filter</span>
|
||
|
<span class="ruby-keyword">end</span></pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|