parent
589678d97f
commit
32b5b3bdb1
@ -1,32 +0,0 @@
|
||||
= Brazilian Rails
|
||||
|
||||
== Intalação
|
||||
|
||||
script/plugin install svn://rubyforge.org/var/svn/brazilian-rails
|
||||
|
||||
Para usar a pluralização em português (Inflector) basta adicionar a linha abaixo no seu enviroment.rb
|
||||
|
||||
require 'inflector_portuguese'
|
||||
|
||||
== Desenvolvedores
|
||||
|
||||
* {Marcos Cóssio Tapajós Martins do Couto}[http://www.improveit.com.br/tapajos]
|
||||
* {Celestino Ferreira Gomes}[http://www.workingwithrails.com/person/8470-celestino-gomes]
|
||||
* André Luiz Kupkovski
|
||||
* Rafael Fraga Walter
|
||||
* Fernando João Manfroi
|
||||
* Luciene Souza Luna
|
||||
* {Vinicius Manhaes Teles}[http://www.improveit.com.br/vinicius]
|
||||
|
||||
== Exemplos.
|
||||
|
||||
* Time
|
||||
* Date
|
||||
* Dinheiro. OBS: Para saber como utilizar a classe Dinheiro em um modelo da sua aplicação, verifique o arquivo {README}[link:files/vendor/plugins/brazilian-rails/samples/dinheiro/README.html] no diretório samples/dinheiro.
|
||||
* Extenso
|
||||
* ActiveRecord::Errors
|
||||
* ActionView::Helpers::ActiveRecordHelper
|
||||
* ActionView::Helpers::DateHelper
|
||||
* Inflector
|
||||
* NilClass
|
||||
* ActiveSupport::CoreExtensions::String::Conversions
|
@ -1,22 +0,0 @@
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rake/rdoctask'
|
||||
|
||||
desc 'Default: run unit tests.'
|
||||
task :default => :test
|
||||
|
||||
desc 'Test the Brazilian Rails plugin.'
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << 'lib'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
|
||||
desc 'Generate documentation for the Brazilian Rails plugin.'
|
||||
Rake::RDocTask.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'Brazilian Rails'
|
||||
rdoc.options << '--line-numbers' << '--inline-source'
|
||||
rdoc.rdoc_files.include('README')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActionView</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActionView</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Module <a href="ActionView/Helpers.html" class="link">ActionView::Helpers</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,108 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActionView::Helpers</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActionView::Helpers</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Module <a href="Helpers/ActiveRecordHelper.html" class="link">ActionView::Helpers::ActiveRecordHelper</a><br />
|
||||
Module <a href="Helpers/DateHelper.html" class="link">ActionView::Helpers::DateHelper</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,164 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActionView::Helpers::ActiveRecordHelper</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActionView::Helpers::ActiveRecordHelper</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../../../files/vendor/plugins/brazilian-rails/lib/action_view_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000033">error_messages_for</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000033" class="method-detail">
|
||||
<a name="M000033"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000033" class="method-signature">
|
||||
<span class="method-name">error_messages_for</span><span class="method-args">(*params)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000033-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb, line 2</span>
|
||||
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_messages_for</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">params</span>)
|
||||
3: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">symbolize_keys</span> <span class="ruby-operator">:</span> {}
|
||||
4: <span class="ruby-identifier">objects</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">object_name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span><span class="ruby-operator">+</span><span class="ruby-identifier">object_name</span>.<span class="ruby-identifier">to_s</span>()) }
|
||||
5: <span class="ruby-identifier">objects</span>.<span class="ruby-identifier">compact!</span>
|
||||
6: <span class="ruby-identifier">count</span> = <span class="ruby-identifier">objects</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">object</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">count</span> }
|
||||
7: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">zero?</span>
|
||||
8: <span class="ruby-identifier">html</span> = {}
|
||||
9: [<span class="ruby-identifier">:id</span>, <span class="ruby-identifier">:class</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
||||
10: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">key</span>)
|
||||
11: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>]
|
||||
12: <span class="ruby-identifier">html</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">blank?</span>
|
||||
13: <span class="ruby-keyword kw">else</span>
|
||||
14: <span class="ruby-identifier">html</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-value str">'errorExplanation'</span>
|
||||
15: <span class="ruby-keyword kw">end</span>
|
||||
16: <span class="ruby-keyword kw">end</span>
|
||||
17: <span class="ruby-identifier">header_message</span> = <span class="ruby-node">"#{pluralize(count, 'erro')} para #{(options[:object_name] || params.first).to_s.gsub('_', ' ')}"</span>
|
||||
18: <span class="ruby-identifier">error_messages</span> = <span class="ruby-identifier">objects</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">full_messages</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">msg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:li</span>, <span class="ruby-identifier">msg</span>) } }
|
||||
19: <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:div</span>,
|
||||
20: <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:header_tag</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:h2</span>, <span class="ruby-identifier">header_message</span>) <span class="ruby-operator"><<</span>
|
||||
21: <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:p</span>, <span class="ruby-value str">'Foram detectados os seguintes erros:'</span>) <span class="ruby-operator"><<</span>
|
||||
22: <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:ul</span>, <span class="ruby-identifier">error_messages</span>),
|
||||
23: <span class="ruby-identifier">html</span>
|
||||
24: )
|
||||
25: <span class="ruby-keyword kw">else</span>
|
||||
26: <span class="ruby-value str">''</span>
|
||||
27: <span class="ruby-keyword kw">end</span>
|
||||
28: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActionView::Helpers::DateHelper</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActionView::Helpers::DateHelper</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../../../files/vendor/plugins/brazilian-rails/lib/action_view_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000034">distance_of_time_in_words</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000034" class="method-detail">
|
||||
<a name="M000034"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000034" class="method-signature">
|
||||
<span class="method-name">distance_of_time_in_words</span><span class="method-args">(from_time, to_time = 0, include_seconds = false)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000034-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb, line 32</span>
|
||||
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">distance_of_time_in_words</span>(<span class="ruby-identifier">from_time</span>, <span class="ruby-identifier">to_time</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">include_seconds</span> = <span class="ruby-keyword kw">false</span>)
|
||||
33: <span class="ruby-identifier">from_time</span> = <span class="ruby-identifier">from_time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">from_time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_time</span>)
|
||||
34: <span class="ruby-identifier">to_time</span> = <span class="ruby-identifier">to_time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to_time</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_time</span>)
|
||||
35: <span class="ruby-identifier">distance_in_minutes</span> = (((<span class="ruby-identifier">to_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">from_time</span>).<span class="ruby-identifier">abs</span>)<span class="ruby-operator">/</span><span class="ruby-value">60</span>).<span class="ruby-identifier">round</span>
|
||||
36: <span class="ruby-identifier">distance_in_seconds</span> = ((<span class="ruby-identifier">to_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">from_time</span>).<span class="ruby-identifier">abs</span>).<span class="ruby-identifier">round</span>
|
||||
37:
|
||||
38: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">distance_in_minutes</span>
|
||||
39: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>
|
||||
40: <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">distance_in_minutes</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">'menos de um minuto'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'1 minuto'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">include_seconds</span>
|
||||
41: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">distance_in_seconds</span>
|
||||
42: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">4</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'menos de 5 segundos'</span>
|
||||
43: <span class="ruby-keyword kw">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">9</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'menos de 10 segundos'</span>
|
||||
44: <span class="ruby-keyword kw">when</span> <span class="ruby-value">10</span><span class="ruby-operator">..</span><span class="ruby-value">19</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'menos de 20 segundos'</span>
|
||||
45: <span class="ruby-keyword kw">when</span> <span class="ruby-value">20</span><span class="ruby-operator">..</span><span class="ruby-value">39</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'meio minuto'</span>
|
||||
46: <span class="ruby-keyword kw">when</span> <span class="ruby-value">40</span><span class="ruby-operator">..</span><span class="ruby-value">59</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'menos de um minuto'</span>
|
||||
47: <span class="ruby-keyword kw">else</span> <span class="ruby-value str">'1 minuto'</span>
|
||||
48: <span class="ruby-keyword kw">end</span>
|
||||
49:
|
||||
50: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">44</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">"#{distance_in_minutes} minutos"</span>
|
||||
51: <span class="ruby-keyword kw">when</span> <span class="ruby-value">45</span><span class="ruby-operator">..</span><span class="ruby-value">89</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'aproximadamente 1 hora'</span>
|
||||
52: <span class="ruby-keyword kw">when</span> <span class="ruby-value">90</span><span class="ruby-operator">..</span><span class="ruby-value">1439</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">"aproximadamente #{(distance_in_minutes.to_f / 60.0).round} horas"</span>
|
||||
53: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1440</span><span class="ruby-operator">..</span><span class="ruby-value">2879</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'1 dia'</span>
|
||||
54: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2880</span><span class="ruby-operator">..</span><span class="ruby-value">43199</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">"#{(distance_in_minutes / 1440).round} dias"</span>
|
||||
55: <span class="ruby-keyword kw">when</span> <span class="ruby-value">43200</span><span class="ruby-operator">..</span><span class="ruby-value">86399</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'aproximadamente 1 mês'</span>
|
||||
56: <span class="ruby-keyword kw">when</span> <span class="ruby-value">86400</span><span class="ruby-operator">..</span><span class="ruby-value">525959</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">"#{(distance_in_minutes / 43200).round} meses"</span>
|
||||
57: <span class="ruby-keyword kw">when</span> <span class="ruby-value">525960</span><span class="ruby-operator">..</span><span class="ruby-value">1051919</span> <span class="ruby-keyword kw">then</span> <span class="ruby-value str">'aproximadamente 1 ano'</span>
|
||||
58: <span class="ruby-keyword kw">else</span> <span class="ruby-node">"mais de #{(distance_in_minutes / 525960).round} anos"</span>
|
||||
59: <span class="ruby-keyword kw">end</span>
|
||||
60: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActiveRecord</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActiveRecord</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/active_record_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/active_record_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Class <a href="ActiveRecord/Errors.html" class="link">ActiveRecord::Errors</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Class: ActiveRecord::Errors</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Class</strong></td>
|
||||
<td class="class-name-in-header">ActiveRecord::Errors</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../../files/vendor/plugins/brazilian-rails/lib/active_record_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/active_record_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Parent:</strong></td>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActiveSupport</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActiveSupport</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Module <a href="ActiveSupport/CoreExtensions.html" class="link">ActiveSupport::CoreExtensions</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActiveSupport::CoreExtensions</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActiveSupport::CoreExtensions</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Module <a href="CoreExtensions/String.html" class="link">ActiveSupport::CoreExtensions::String</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActiveSupport::CoreExtensions::String</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActiveSupport::CoreExtensions::String</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
<div id="class-list">
|
||||
<h3 class="section-bar">Classes and Modules</h3>
|
||||
|
||||
Module <a href="String/Conversions.html" class="link">ActiveSupport::CoreExtensions::String::Conversions</a><br />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,144 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ActiveSupport::CoreExtensions::String::Conversions</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ActiveSupport::CoreExtensions::String::Conversions</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../../../../files/vendor/plugins/brazilian-rails/lib/date_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/date_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000029">to_date</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000029" class="method-detail">
|
||||
<a name="M000029"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000029" class="method-signature">
|
||||
<span class="method-name">to_date</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000029-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/date_portuguese.rb, line 2</span>
|
||||
2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_date</span>
|
||||
3: <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/(\d{1,2})\W(\d{1,2})\W(\d{4})/</span> <span class="ruby-operator">=~</span> <span class="ruby-keyword kw">self</span>
|
||||
4: <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>)
|
||||
5: <span class="ruby-keyword kw">else</span>
|
||||
6: <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-constant">ParseDate</span>.<span class="ruby-identifier">parsedate</span>(<span class="ruby-keyword kw">self</span>)[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>])
|
||||
7: <span class="ruby-keyword kw">end</span>
|
||||
8: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,198 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Class: Date</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Class</strong></td>
|
||||
<td class="class-name-in-header">Date</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/date_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/date_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Parent:</strong></td>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000027">to_s_br</a>
|
||||
<a href="#M000028">valid?</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Class methods</h3>
|
||||
|
||||
<div id="method-M000028" class="method-detail">
|
||||
<a name="M000028"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000028" class="method-signature">
|
||||
<span class="method-name">valid?</span><span class="method-args">(date)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Valida se uma string eh uma data valida
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Date.valid?('01/01/2007') ==> true
|
||||
Date.valid?('32/01/2007') ==> false
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000028-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/date_portuguese.rb, line 26</span>
|
||||
26: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">date</span>)
|
||||
27: <span class="ruby-keyword kw">begin</span>
|
||||
28: <span class="ruby-identifier">date</span> = <span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_date</span>
|
||||
29: <span class="ruby-constant">Date</span>.<span class="ruby-identifier">valid_civil?</span>(<span class="ruby-identifier">date</span>.<span class="ruby-identifier">year</span>, <span class="ruby-identifier">date</span>.<span class="ruby-identifier">month</span>, <span class="ruby-identifier">date</span>.<span class="ruby-identifier">day</span>)
|
||||
30: <span class="ruby-keyword kw">rescue</span>
|
||||
31: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
||||
32: <span class="ruby-keyword kw">end</span>
|
||||
33: <span class="ruby-keyword kw">true</span>
|
||||
34: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000027" class="method-detail">
|
||||
<a name="M000027"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000027" class="method-signature">
|
||||
<span class="method-name">to_s_br</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a data no padrao brasileiro
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
data = Date.new(2007, 9, 27)
|
||||
data.to_s_br ==> "27/09/2007"
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000027-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/date_portuguese.rb, line 17</span>
|
||||
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s_br</span>
|
||||
18: <span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%d/%m/%Y"</span>)
|
||||
19: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,140 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: DateUtils</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">DateUtils</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/date_utils_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/date_utils.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000019">to_s_br</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000019" class="method-detail">
|
||||
<a name="M000019"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000019" class="method-signature">
|
||||
<span class="method-name">to_s_br</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000019-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/date_utils.rb, line 3</span>
|
||||
3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s_br</span>
|
||||
4: <span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%d/%m/%Y"</span>)
|
||||
5: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,723 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Class: Dinheiro</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Class</strong></td>
|
||||
<td class="class-name-in-header">Dinheiro</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/dinheiro_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/dinheiro.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Parent:</strong></td>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000009">*</a>
|
||||
<a href="#M000007">+</a>
|
||||
<a href="#M000008">-</a>
|
||||
<a href="#M000010">/</a>
|
||||
<a href="#M000006"><=></a>
|
||||
<a href="#M000005">==</a>
|
||||
<a href="#M000015">coerce</a>
|
||||
<a href="#M000020">contabil</a>
|
||||
<a href="#M000003">new</a>
|
||||
<a href="#M000011">por_extenso</a>
|
||||
<a href="#M000012">por_extenso_em_reais</a>
|
||||
<a href="#M000018">reais</a>
|
||||
<a href="#M000019">reais_contabeis</a>
|
||||
<a href="#M000016">real</a>
|
||||
<a href="#M000017">real_contabil</a>
|
||||
<a href="#M000013">to_extenso</a>
|
||||
<a href="#M000014">to_f</a>
|
||||
<a href="#M000004">to_s</a>
|
||||
<a href="#M000021">valor_decimal</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
<div id="includes">
|
||||
<h3 class="section-bar">Included Modules</h3>
|
||||
|
||||
<div id="includes-list">
|
||||
<span class="include-name">Comparable</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
<div id="constants-list">
|
||||
<h3 class="section-bar">Constants</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<table summary="Constants">
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">FORMATO_VALIDO_BR</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">/^([R|r]\$\s*)?(([+-]?\d{1,3}(\.?\d{3})*))?(\,\d{0,2})?$/</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">FORMATO_VALIDO_EUA</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">/^([R|r]\$\s*)?(([+-]?\d{1,3}(\,?\d{3})*))?(\.\d{0,2})?$/</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">SEPARADOR_MILHAR</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">"."</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">SEPARADOR_FRACIONARIO</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">","</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">QUANTIDADE_DIGITOS</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">3</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">PRECISAO_DECIMAL</td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value">100</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="attribute-list">
|
||||
<h3 class="section-bar">Attributes</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<table>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name">quantia</td>
|
||||
<td class="context-item-value"> [R] </td>
|
||||
<td class="context-item-desc"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Class methods</h3>
|
||||
|
||||
<div id="method-M000003" class="method-detail">
|
||||
<a name="M000003"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000003" class="method-signature">
|
||||
<span class="method-name">new</span><span class="method-args">(quantia)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000003-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 14</span>
|
||||
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">quantia</span>)
|
||||
15: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">quantia</span> = <span class="ruby-identifier">quantia</span>
|
||||
16: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000009" class="method-detail">
|
||||
<a name="M000009"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000009" class="method-signature">
|
||||
<span class="method-name">*</span><span class="method-args">(outro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a multiplicacao entre dinheiros.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000009-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 60</span>
|
||||
60: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">*</span>(<span class="ruby-identifier">outro</span>)
|
||||
61: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">outro</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">outro</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Dinheiro</span>
|
||||
62: <span class="ruby-identifier">outro</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">to_f</span>
|
||||
63: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000007" class="method-detail">
|
||||
<a name="M000007"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000007" class="method-signature">
|
||||
<span class="method-name">+</span><span class="method-args">(outro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a adicao entre dinheiros.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000007-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 50</span>
|
||||
50: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">outro</span>)
|
||||
51: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">transforma_em_string_que_represente_a_quantia</span>(<span class="ruby-ivar">@quantia</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">quantia_de</span>(<span class="ruby-identifier">outro</span>)))
|
||||
52: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000008" class="method-detail">
|
||||
<a name="M000008"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000008" class="method-signature">
|
||||
<span class="method-name">-</span><span class="method-args">(outro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a subtracao entre dinheiros.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000008-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 55</span>
|
||||
55: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">outro</span>)
|
||||
56: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">transforma_em_string_que_represente_a_quantia</span>(<span class="ruby-ivar">@quantia</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">quantia_de</span>(<span class="ruby-identifier">outro</span>)))
|
||||
57: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000010" class="method-detail">
|
||||
<a name="M000010"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000010" class="method-signature">
|
||||
<span class="method-name">/</span><span class="method-args">(outro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a divisao entre dinheiros.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000010-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 66</span>
|
||||
66: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">/</span>(<span class="ruby-identifier">outro</span>)
|
||||
67: <span class="ruby-identifier">raise</span> <span class="ruby-constant">DivisaPorNaoEscalarError</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">outro</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Numeric</span>)
|
||||
68: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@quantia</span><span class="ruby-operator">/</span><span class="ruby-identifier">outro</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">outro</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
||||
69: <span class="ruby-identifier">soma_parcial</span> = <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
|
||||
70: <span class="ruby-identifier">parcelas</span> = []
|
||||
71: (<span class="ruby-identifier">outro</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span>
|
||||
72: <span class="ruby-identifier">parcela</span> = <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">transforma_em_string_que_represente_a_quantia</span>(<span class="ruby-ivar">@quantia</span><span class="ruby-operator">/</span><span class="ruby-identifier">outro</span>))
|
||||
73: <span class="ruby-identifier">parcelas</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parcela</span>
|
||||
74: <span class="ruby-identifier">soma_parcial</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parcela</span>
|
||||
75: <span class="ruby-keyword kw">end</span>
|
||||
76: <span class="ruby-identifier">parcelas</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">transforma_em_string_que_represente_a_quantia</span>(<span class="ruby-ivar">@quantia</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">quantia_de</span>(<span class="ruby-identifier">soma_parcial</span>)))
|
||||
77: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000006" class="method-detail">
|
||||
<a name="M000006"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000006" class="method-signature">
|
||||
<span class="method-name"><=></span><span class="method-args">(outro_dinheiro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Compara com outro dinheiro se eh maior ou menor.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.real < 2.reais ==> true
|
||||
1.real > 2.reais ==> false
|
||||
2.real < 1.reais ==> false
|
||||
2.real > 1.reais ==> true
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000006-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 44</span>
|
||||
44: <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">outro_dinheiro</span>)
|
||||
45: <span class="ruby-identifier">outro_dinheiro</span> = <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">outro_dinheiro</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">outro_dinheiro</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Dinheiro</span>)
|
||||
46: <span class="ruby-ivar">@quantia</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">outro_dinheiro</span>.<span class="ruby-identifier">quantia</span>
|
||||
47: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000005" class="method-detail">
|
||||
<a name="M000005"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000005" class="method-signature">
|
||||
<span class="method-name">==</span><span class="method-args">(outro_dinheiro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Compara com outro dinheiro se eh igual.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
um_real = Dinheiro.new(1)
|
||||
um_real == Dinheiro.new(1) ==> true
|
||||
um_real == Dinheiro.new(2) ==> false
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000005-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 32</span>
|
||||
32: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">outro_dinheiro</span>)
|
||||
33: <span class="ruby-identifier">outro_dinheiro</span> = <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">outro_dinheiro</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">outro_dinheiro</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Dinheiro</span>)
|
||||
34: <span class="ruby-ivar">@quantia</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">outro_dinheiro</span>.<span class="ruby-identifier">quantia</span>
|
||||
35: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000015" class="method-detail">
|
||||
<a name="M000015"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000015" class="method-signature">
|
||||
<span class="method-name">coerce</span><span class="method-args">(outro)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000015-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 102</span>
|
||||
102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">coerce</span>(<span class="ruby-identifier">outro</span>)
|
||||
103: [ <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">outro</span>), <span class="ruby-keyword kw">self</span> ]
|
||||
104: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000020" class="method-detail">
|
||||
<a name="M000020"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000020" class="method-signature">
|
||||
<span class="method-name">contabil</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna uma string formatada.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Dinheiro.new(1).contabil ==> '1,00'
|
||||
Dinheiro.new(-1).contabil ==> '(1,00)'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000020-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 135</span>
|
||||
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">contabil</span>
|
||||
136: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@quantia</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>
|
||||
137: <span class="ruby-identifier">to_s</span>
|
||||
138: <span class="ruby-keyword kw">else</span>
|
||||
139: <span class="ruby-value str">"("</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">to_s</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">")"</span>
|
||||
140: <span class="ruby-keyword kw">end</span>
|
||||
141: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000011" class="method-detail">
|
||||
<a name="M000011"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000011" class="method-signature">
|
||||
<span class="method-name">por_extenso</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Escreve o valor por extenso.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.real.por_extenso ==> 'um real'
|
||||
(100.58).por_extenso ==> 'cem reais e cinquenta e oito centavos'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000011-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 84</span>
|
||||
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">por_extenso</span>
|
||||
85: (<span class="ruby-ivar">@quantia</span><span class="ruby-operator">/</span><span class="ruby-value">100.0</span>).<span class="ruby-identifier">por_extenso_em_reais</span>
|
||||
86: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000012" class="method-detail">
|
||||
<a name="M000012"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<span class="method-name">por_extenso_em_reais</span><span class="method-args">()</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Alias for <a href="Dinheiro.html#M000011">por_extenso</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000018" class="method-detail">
|
||||
<a name="M000018"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<span class="method-name">reais</span><span class="method-args">()</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Alias for <a href="Dinheiro.html#M000016">real</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000019" class="method-detail">
|
||||
<a name="M000019"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<span class="method-name">reais_contabeis</span><span class="method-args">()</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Alias for <a href="Dinheiro.html#M000017">real_contabil</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000016" class="method-detail">
|
||||
<a name="M000016"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000016" class="method-signature">
|
||||
<span class="method-name">real</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna uma string formatada em valor monetario.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Dinheiro.new(1).real ==> 'R$ 1,00'
|
||||
Dinheiro.new(-1).real ==> 'R$ -1,00'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000016-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 111</span>
|
||||
111: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real</span>
|
||||
112: <span class="ruby-value str">"R$ "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">to_s</span>
|
||||
113: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000017" class="method-detail">
|
||||
<a name="M000017"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000017" class="method-signature">
|
||||
<span class="method-name">real_contabil</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna uma string formatada em valor monetario.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Dinheiro.new(1).real ==> 'R$ 1,00'
|
||||
Dinheiro.new(-1).real ==> 'R$ (1,00)'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000017-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 120</span>
|
||||
120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real_contabil</span>
|
||||
121: <span class="ruby-value str">"R$ "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">contabil</span>
|
||||
122: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000013" class="method-detail">
|
||||
<a name="M000013"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000013" class="method-signature">
|
||||
<span class="method-name">to_extenso</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
DEPRECATION WARNING: use <a href="Dinheiro.html#M000011">por_extenso</a> ou
|
||||
<a href="Dinheiro.html#M000012">por_extenso_em_reais</a>, pois este sera
|
||||
removido no proximo release.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000013-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 92</span>
|
||||
92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_extenso</span>
|
||||
93: <span class="ruby-identifier">warn</span>(<span class="ruby-value str">"DEPRECATION WARNING: use por_extenso ou por_extenso_em_reais, pois este sera removido no proximo release."</span>)
|
||||
94: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">por_extenso</span>
|
||||
95: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000014" class="method-detail">
|
||||
<a name="M000014"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000014" class="method-signature">
|
||||
<span class="method-name">to_f</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna um Float.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000014-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 98</span>
|
||||
98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_f</span>
|
||||
99: <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">','</span>, <span class="ruby-value str">'.'</span>).<span class="ruby-identifier">to_f</span>
|
||||
100: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000004" class="method-detail">
|
||||
<a name="M000004"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000004" class="method-signature">
|
||||
<span class="method-name">to_s</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna o valor armazenado em string.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1000.to_s ==> '1.000,00'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000004-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 22</span>
|
||||
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
||||
23: <span class="ruby-identifier">inteiro_com_milhar</span>(<span class="ruby-identifier">parte_inteira</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">parte_decimal</span>
|
||||
24: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000021" class="method-detail">
|
||||
<a name="M000021"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000021" class="method-signature">
|
||||
<span class="method-name">valor_decimal</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna um BigDecinal.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000021-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro.rb, line 144</span>
|
||||
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valor_decimal</span>
|
||||
145: <span class="ruby-constant">BigDecimal</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">quantia_sem_separacao_milhares</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">','</span>,<span class="ruby-value str">'.'</span>)
|
||||
146: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,281 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: DinheiroUtil</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">DinheiroUtil</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/dinheiro_util_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/dinheiro_util.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000043">contabil</a>
|
||||
<a href="#M000038">para_dinheiro</a>
|
||||
<a href="#M000039">reais</a>
|
||||
<a href="#M000042">reais_contabeis</a>
|
||||
<a href="#M000040">real</a>
|
||||
<a href="#M000041">real_contabil</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000043" class="method-detail">
|
||||
<a name="M000043"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000043" class="method-signature">
|
||||
<span class="method-name">contabil</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna string formatada com simbolo monetario
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.contabil ==> '1,00'
|
||||
-1.contabil ==> '(1,00)'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000043-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro_util.rb, line 39</span>
|
||||
39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">contabil</span>
|
||||
40: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">contabil</span>
|
||||
41: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000038" class="method-detail">
|
||||
<a name="M000038"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000038" class="method-signature">
|
||||
<span class="method-name">para_dinheiro</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Transforma numero em dinheiro
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.para_dinheiro.class ==> Dinheiro
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000038-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro_util.rb, line 6</span>
|
||||
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">para_dinheiro</span>
|
||||
7: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
||||
8: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000039" class="method-detail">
|
||||
<a name="M000039"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<span class="method-name">reais</span><span class="method-args">()</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Alias for <a href="DinheiroUtil.html#M000038">para_dinheiro</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000042" class="method-detail">
|
||||
<a name="M000042"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000042" class="method-signature">
|
||||
<span class="method-name">reais_contabeis</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna string formatada com simbolo monetario
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
2.reais_contabeis ==> 'R$ 2,00'
|
||||
-2.reais_contabeis ==> 'R$ 2,00'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000042-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro_util.rb, line 30</span>
|
||||
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reais_contabeis</span>
|
||||
31: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">reais_contabeis</span>
|
||||
32: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000040" class="method-detail">
|
||||
<a name="M000040"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<span class="method-name">real</span><span class="method-args">()</span>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Alias for <a href="DinheiroUtil.html#M000038">para_dinheiro</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000041" class="method-detail">
|
||||
<a name="M000041"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000041" class="method-signature">
|
||||
<span class="method-name">real_contabil</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna string formatada com simbolo monetario
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.real_contabil ==> 'R$ 1,00'
|
||||
-1.real_contabil ==> 'R$ (1,00)'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000041-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/dinheiro_util.rb, line 21</span>
|
||||
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real_contabil</span>
|
||||
22: <span class="ruby-constant">Dinheiro</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">real_contabil</span>
|
||||
23: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,251 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: Extenso</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">Extenso</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/number_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/number_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000035">por_extenso</a>
|
||||
<a href="#M000037">por_extenso</a>
|
||||
<a href="#M000036">to_extenso</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Class methods</h3>
|
||||
|
||||
<div id="method-M000037" class="method-detail">
|
||||
<a name="M000037"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000037" class="method-signature">
|
||||
<span class="method-name">por_extenso</span><span class="method-args">(numero)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Escreve o numero por extenso.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Extenso.por_extenso(1) ==> "um"
|
||||
Extenso.por_extenso(100) ==> "cem"
|
||||
Extenso.por_extenso(158) ==> "cento e cinquenta e oito"
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000037-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 65</span>
|
||||
65: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Extenso</span>.<span class="ruby-identifier">por_extenso</span>(<span class="ruby-identifier">numero</span>)
|
||||
66: <span class="ruby-identifier">n</span>=<span class="ruby-identifier">numero</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">abs</span>
|
||||
67: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">n</span>
|
||||
68: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">9</span><span class="ruby-operator">:</span> <span class="ruby-ivar">@@unidade</span>[<span class="ruby-identifier">n</span>].<span class="ruby-identifier">to_s</span>
|
||||
69: <span class="ruby-keyword kw">when</span> <span class="ruby-value">10</span><span class="ruby-operator">..</span><span class="ruby-value">19</span><span class="ruby-operator">:</span> <span class="ruby-ivar">@@dezena</span>[<span class="ruby-identifier">n</span>].<span class="ruby-identifier">to_s</span>
|
||||
70: <span class="ruby-keyword kw">when</span> <span class="ruby-value">20</span><span class="ruby-operator">..</span><span class="ruby-value">99</span><span class="ruby-operator">:</span>
|
||||
71: <span class="ruby-identifier">v</span>=<span class="ruby-identifier">n</span> <span class="ruby-operator">%</span> <span class="ruby-value">10</span>
|
||||
72: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span><span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
||||
73: <span class="ruby-ivar">@@dezena</span>[<span class="ruby-identifier">n</span>].<span class="ruby-identifier">to_s</span>
|
||||
74: <span class="ruby-keyword kw">else</span>
|
||||
75: <span class="ruby-node">"#{@@dezena[n-v]} e #{por_extenso(v)}"</span>
|
||||
76: <span class="ruby-keyword kw">end</span>
|
||||
77: <span class="ruby-keyword kw">when</span> <span class="ruby-value">100</span>
|
||||
78: <span class="ruby-value str">"cem"</span>
|
||||
79: <span class="ruby-keyword kw">when</span> <span class="ruby-value">101</span><span class="ruby-operator">..</span><span class="ruby-value">999</span>
|
||||
80: <span class="ruby-identifier">v</span>=<span class="ruby-identifier">n</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span>
|
||||
81: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span><span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
||||
82: <span class="ruby-ivar">@@centena</span>[<span class="ruby-identifier">n</span>].<span class="ruby-identifier">to_s</span>
|
||||
83: <span class="ruby-keyword kw">else</span>
|
||||
84: <span class="ruby-node">"#{@@centena[n-v]} e #{por_extenso(v)}"</span>
|
||||
85: <span class="ruby-keyword kw">end</span>
|
||||
86: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1000</span><span class="ruby-operator">..</span><span class="ruby-value">999999</span>
|
||||
87: <span class="ruby-identifier">m</span>,<span class="ruby-identifier">c</span>=<span class="ruby-identifier">n</span><span class="ruby-operator">/</span><span class="ruby-value">1000</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">%</span><span class="ruby-value">1000</span>
|
||||
88: <span class="ruby-node">%(#{por_extenso(m)} mil#{c > 0 ? " e #{por_extenso(c)}":''})</span>
|
||||
89: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1_000_000</span><span class="ruby-operator">..</span><span class="ruby-value">999_999_999</span>
|
||||
90: <span class="ruby-identifier">mi</span>,<span class="ruby-identifier">m</span>=<span class="ruby-identifier">n</span><span class="ruby-operator">/</span><span class="ruby-value">1_000_000</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">%</span><span class="ruby-value">1_000_000</span>
|
||||
91: <span class="ruby-node">%(#{por_extenso(mi)} milh#{mi > 1 ? 'ões':'ão'}#{m > 0 ? " e #{por_extenso(m)}" : ''})</span>
|
||||
92: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1_000_000_000</span><span class="ruby-operator">..</span><span class="ruby-value">999_999_999_999</span>
|
||||
93: <span class="ruby-identifier">bi</span>,<span class="ruby-identifier">mi</span>=<span class="ruby-identifier">n</span><span class="ruby-operator">/</span><span class="ruby-value">1_000_000_000</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">%</span><span class="ruby-value">1_000_000_000</span>
|
||||
94: <span class="ruby-node">%(#{por_extenso(bi)} bilh#{bi > 1 ? 'ões':'ão'}#{mi > 0 ? " e #{por_extenso(mi)}" : ''})</span>
|
||||
95: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1_000_000_000_000</span><span class="ruby-operator">..</span><span class="ruby-value">999_999_999_999_999</span>
|
||||
96: <span class="ruby-identifier">tri</span>,<span class="ruby-identifier">bi</span>=<span class="ruby-identifier">n</span><span class="ruby-operator">/</span><span class="ruby-value">1_000_000_000_000</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">%</span><span class="ruby-value">1_000_000_000_000</span>
|
||||
97: <span class="ruby-node">%(#{por_extenso(tri)} trilh#{tri > 1 ? 'ões':'ão'}#{bi > 0 ? " e #{por_extenso(bi)}" : ''})</span>
|
||||
98: <span class="ruby-keyword kw">else</span>
|
||||
99: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Valor excede o permitido: #{n}"</span>
|
||||
100: <span class="ruby-keyword kw">end</span>
|
||||
101: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000035" class="method-detail">
|
||||
<a name="M000035"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000035" class="method-signature">
|
||||
<span class="method-name">por_extenso</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Escreve o numero por extenso.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.por_extenso ==> 'um'
|
||||
100.por_extenso ==> 'cem'
|
||||
158.por_extenso ==> 'cento e cinquenta e oito'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000035-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 49</span>
|
||||
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">por_extenso</span>
|
||||
50: <span class="ruby-constant">Extenso</span>.<span class="ruby-identifier">por_extenso</span>(<span class="ruby-keyword kw">self</span>)
|
||||
51: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000036" class="method-detail">
|
||||
<a name="M000036"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000036" class="method-signature">
|
||||
<span class="method-name">to_extenso</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
DEPRECATION WARNING: use <a href="Extenso.html#M000035">por_extenso</a>,
|
||||
pois este sera removido no proximo release.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000036-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 54</span>
|
||||
54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_extenso</span>
|
||||
55: <span class="ruby-identifier">warn</span>(<span class="ruby-value str">'DEPRECATION WARNING: use por_extenso, pois este sera removido no proximo release.'</span>)
|
||||
56: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">por_extenso</span>
|
||||
57: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,251 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: ExtensoReal</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">ExtensoReal</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/number_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/number_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000030">por_extenso_em_reais</a>
|
||||
<a href="#M000032">por_extenso_em_reais</a>
|
||||
<a href="#M000031">to_extenso_real</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
<div id="includes">
|
||||
<h3 class="section-bar">Included Modules</h3>
|
||||
|
||||
<div id="includes-list">
|
||||
<span class="include-name"><a href="Extenso.html">Extenso</a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Class methods</h3>
|
||||
|
||||
<div id="method-M000032" class="method-detail">
|
||||
<a name="M000032"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000032" class="method-signature">
|
||||
<span class="method-name">por_extenso_em_reais</span><span class="method-args">(valor)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Escreve o numero por extenso em reais.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
Extenso.por_extenso_em_reais(1) ==> "um real"
|
||||
Extenso.por_extenso_em_reais(100) ==> "cem reais"
|
||||
Extenso.por_extenso_em_reais(100.58) ==> "cem reais e cinquenta e oito centavos"
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000032-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 128</span>
|
||||
128: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">ExtensoReal</span>.<span class="ruby-identifier">por_extenso_em_reais</span>(<span class="ruby-identifier">valor</span>)
|
||||
129: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'grátis'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">valor</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
||||
130: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">valor</span>
|
||||
131: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Integer</span>
|
||||
132: <span class="ruby-identifier">extenso</span> = <span class="ruby-constant">Extenso</span>.<span class="ruby-identifier">por_extenso</span>(<span class="ruby-identifier">valor</span>)
|
||||
133: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">extenso</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(.*)(ão$|ões$)/</span>
|
||||
134: <span class="ruby-identifier">complemento</span> = <span class="ruby-value str">'de '</span>
|
||||
135: <span class="ruby-keyword kw">else</span>
|
||||
136: <span class="ruby-identifier">complemento</span> = <span class="ruby-value str">''</span>
|
||||
137: <span class="ruby-keyword kw">end</span>
|
||||
138: <span class="ruby-node">%(#{extenso} #{valor <= 1 ? 'real': "#{complemento}reais"})</span>
|
||||
139: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Float</span>
|
||||
140: <span class="ruby-identifier">real</span>,<span class="ruby-identifier">cents</span>=(<span class="ruby-value str">"%.2f"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">valor</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\./</span>).<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_i</span>}
|
||||
141: <span class="ruby-identifier">valor_cents</span>=<span class="ruby-constant">Extenso</span>.<span class="ruby-identifier">por_extenso</span>(<span class="ruby-identifier">cents</span><span class="ruby-operator">%</span><span class="ruby-value">100</span>)
|
||||
142:
|
||||
143: <span class="ruby-identifier">valor_cents</span><span class="ruby-operator">+=</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">cents</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">%</span><span class="ruby-value">100</span>
|
||||
144: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span><span class="ruby-operator">:</span> <span class="ruby-value str">""</span>
|
||||
145: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span><span class="ruby-operator">:</span> <span class="ruby-value str">" centavo"</span>
|
||||
146: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">99</span><span class="ruby-operator">:</span> <span class="ruby-value str">" centavos"</span>
|
||||
147: <span class="ruby-keyword kw">end</span>
|
||||
148:
|
||||
149: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">real</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
||||
150: <span class="ruby-node">"#{ExtensoReal.por_extenso_em_reais(real.to_i)}#{cents > 0 ? ' e ' + valor_cents : ''}"</span>
|
||||
151: <span class="ruby-keyword kw">else</span>
|
||||
152: <span class="ruby-node">"#{valor_cents}"</span>
|
||||
153: <span class="ruby-keyword kw">end</span>
|
||||
154: <span class="ruby-keyword kw">else</span>
|
||||
155: <span class="ruby-constant">ExtensoReal</span>.<span class="ruby-identifier">por_extenso_em_reais</span>(<span class="ruby-identifier">valor</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[^\d]/</span>,<span class="ruby-value str">'.'</span>).<span class="ruby-identifier">to_f</span>)
|
||||
156: <span class="ruby-keyword kw">end</span>
|
||||
157: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000030" class="method-detail">
|
||||
<a name="M000030"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000030" class="method-signature">
|
||||
<span class="method-name">por_extenso_em_reais</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Escreve por extenso em reais.
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
1.por_extenso_em_reais ==> 'um real'
|
||||
(100.58).por_extenso_em_reais ==> 'cem reais e cinquenta e oito centavos'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000030-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 112</span>
|
||||
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">por_extenso_em_reais</span>
|
||||
113: <span class="ruby-constant">ExtensoReal</span>.<span class="ruby-identifier">por_extenso_em_reais</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
|
||||
114: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000031" class="method-detail">
|
||||
<a name="M000031"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000031" class="method-signature">
|
||||
<span class="method-name">to_extenso_real</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
DEPRECATION WARNING: use <a
|
||||
href="ExtensoReal.html#M000030">por_extenso_em_reais</a>, pois este sera
|
||||
removido no proximo release.
|
||||
</p>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000031-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/number_portuguese.rb, line 117</span>
|
||||
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_extenso_real</span>
|
||||
118: <span class="ruby-identifier">warn</span>(<span class="ruby-value str">'DEPRECATION WARNING: use por_extenso_em_reais, pois este sera removido no proximo release.'</span>)
|
||||
119: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">por_extenso_em_reais</span>
|
||||
120: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: Inflector</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">Inflector</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/inflector_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/inflector_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,242 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Class: NilClass</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Class</strong></td>
|
||||
<td class="class-name-in-header">NilClass</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/nil_class_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/nil_class.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Parent:</strong></td>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000024">para_dinheiro</a>
|
||||
<a href="#M000025">reais</a>
|
||||
<a href="#M000026">real</a>
|
||||
<a href="#M000022">valor</a>
|
||||
<a href="#M000023">valor_contabil</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000024" class="method-detail">
|
||||
<a name="M000024"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000024" class="method-signature">
|
||||
<span class="method-name">para_dinheiro</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000024-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/nil_class.rb, line 11</span>
|
||||
11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">para_dinheiro</span>
|
||||
12: <span class="ruby-value str">""</span>
|
||||
13: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000025" class="method-detail">
|
||||
<a name="M000025"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000025" class="method-signature">
|
||||
<span class="method-name">reais</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000025-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/nil_class.rb, line 15</span>
|
||||
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reais</span>
|
||||
16: <span class="ruby-value str">""</span>
|
||||
17: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000026" class="method-detail">
|
||||
<a name="M000026"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000026" class="method-signature">
|
||||
<span class="method-name">real</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000026-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/nil_class.rb, line 19</span>
|
||||
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real</span>
|
||||
20: <span class="ruby-value str">""</span>
|
||||
21: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000022" class="method-detail">
|
||||
<a name="M000022"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000022" class="method-signature">
|
||||
<span class="method-name">valor</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000022-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/nil_class.rb, line 3</span>
|
||||
3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valor</span>
|
||||
4: <span class="ruby-value str">""</span>
|
||||
5: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000023" class="method-detail">
|
||||
<a name="M000023"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000023" class="method-signature">
|
||||
<span class="method-name">valor_contabil</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000023-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/nil_class.rb, line 7</span>
|
||||
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valor_contabil</span>
|
||||
8: <span class="ruby-value str">""</span>
|
||||
9: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,187 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Module: StringPortuguese</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Module</strong></td>
|
||||
<td class="class-name-in-header">StringPortuguese</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/string_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/string_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000044">nome_proprio</a>
|
||||
<a href="#M000045">remover_acentos</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000044" class="method-detail">
|
||||
<a name="M000044"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000044" class="method-signature">
|
||||
<span class="method-name">nome_proprio</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Normaliza nomes proprios
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
'maria de souza dos santos e silva da costa'.nome_proprio ==> 'Maria de Souza dos Santos e Silva da Costa'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000044-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 6</span>
|
||||
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nome_proprio</span>
|
||||
7: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">titleize</span>().<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ D(a|e|o|as|os) /</span>, <span class="ruby-value str">' d\1 '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ E /</span>, <span class="ruby-value str">' e '</span>)
|
||||
8: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="method-M000045" class="method-detail">
|
||||
<a name="M000045"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000045" class="method-signature">
|
||||
<span class="method-name">remover_acentos</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
remove as letras acentuadas
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
'texto está com acentuação'.remover_acentos ==> 'texto esta com acentuacao'
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000045-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 14</span>
|
||||
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remover_acentos</span>
|
||||
15: <span class="ruby-identifier">texto</span> = <span class="ruby-keyword kw">self</span>
|
||||
16: <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[á|à|ã|â|ä]/</span>, <span class="ruby-value str">'a'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(é|è|ê|ë)/</span>, <span class="ruby-value str">'e'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(í|ì|î|ï)/</span>, <span class="ruby-value str">'i'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(ó|ò|õ|ô|ö)/</span>, <span class="ruby-value str">'o'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(ú|ù|û|ü)/</span>, <span class="ruby-value str">'u'</span>)
|
||||
17: <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Á|À|Ã|Â|Ä)/</span>, <span class="ruby-value str">'A'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(É|È|Ê|Ë)/</span>, <span class="ruby-value str">'E'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Í|Ì|Î|Ï)/</span>, <span class="ruby-value str">'I'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Ó|Ò|Õ|Ô|Ö)/</span>, <span class="ruby-value str">'O'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Ú|Ù|Û|Ü)/</span>, <span class="ruby-value str">'U'</span>)
|
||||
18: <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ñ/</span>, <span class="ruby-value str">'n'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/Ñ/</span>, <span class="ruby-value str">'N'</span>)
|
||||
19: <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ç/</span>, <span class="ruby-value str">'c'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/Ç/</span>, <span class="ruby-value str">'C'</span>)
|
||||
20: <span class="ruby-identifier">texto</span>
|
||||
21: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,156 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>Class: Time</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="classHeader">
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Class</strong></td>
|
||||
<td class="class-name-in-header">Time</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>In:</strong></td>
|
||||
<td>
|
||||
<a href="../files/vendor/plugins/brazilian-rails/lib/time_portuguese_rb.html">
|
||||
vendor/plugins/brazilian-rails/lib/time_portuguese.rb
|
||||
</a>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Parent:</strong></td>
|
||||
<td>
|
||||
Object
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000002">to_s_br</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000002" class="method-detail">
|
||||
<a name="M000002"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000002" class="method-signature">
|
||||
<span class="method-name">to_s_br</span><span class="method-args">()</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p>
|
||||
Retorna a hora no padrao brasileiro
|
||||
</p>
|
||||
<p>
|
||||
Exemplo:
|
||||
</p>
|
||||
<pre>
|
||||
hora = Time.new
|
||||
hora.to_s_br ==> "27/09/2007 13:54"
|
||||
</pre>
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000002-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/time_portuguese.rb, line 7</span>
|
||||
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s_br</span>
|
||||
8: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">"%d/%m/%Y %H:%M"</span>)
|
||||
9: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
Thu, 27 Sep 2007 15:08:09 -0300
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: action_view_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>action_view_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Tue Sep 25 13:30:14 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: active_record_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>active_record_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/active_record_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Tue Sep 25 13:30:14 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: date_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>date_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/date_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 15:06:30 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: date_utils.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>date_utils.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/date_utils.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Fri Aug 03 15:47:53 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: dinheiro.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>dinheiro.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/dinheiro.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 14:58:35 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: dinheiro_util.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>dinheiro_util.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/dinheiro_util.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 14:42:35 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,136 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: excecoes.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>excecoes.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/excecoes.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Tue Sep 25 13:30:14 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="method-list">
|
||||
<h3 class="section-bar">Methods</h3>
|
||||
|
||||
<div class="name-list">
|
||||
<a href="#M000001">cria_excecao</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
<div id="methods">
|
||||
<h3 class="section-bar">Public Instance methods</h3>
|
||||
|
||||
<div id="method-M000001" class="method-detail">
|
||||
<a name="M000001"></a>
|
||||
|
||||
<div class="method-heading">
|
||||
<a href="#M000001" class="method-signature">
|
||||
<span class="method-name">cria_excecao</span><span class="method-args">(classe, mensagem)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="method-description">
|
||||
<p><a class="source-toggle" href="#"
|
||||
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
||||
<div class="method-source-code" id="M000001-source">
|
||||
<pre>
|
||||
<span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/excecoes.rb, line 1</span>
|
||||
1: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cria_excecao</span>(<span class="ruby-identifier">classe</span>, <span class="ruby-identifier">mensagem</span>)
|
||||
2: <span class="ruby-identifier">eval</span> <span class="ruby-node">"class #{classe}; def initialize; super('#{mensagem}'); end; end"</span>
|
||||
3: <span class="ruby-keyword kw">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: inflector_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>inflector_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/inflector_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 14:24:11 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: nil_class.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>nil_class.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/nil_class.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Tue Sep 25 13:30:14 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: number_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>number_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/number_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 12:25:07 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: string_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>string_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/string_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 15:07:48 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!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>File: time_portuguese.rb</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
function popupCode( url ) {
|
||||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
||||
}
|
||||
|
||||
function toggleCode( id ) {
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
elemStyle = elem.style;
|
||||
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make codeblocks hidden by default
|
||||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
||||
|
||||
// ]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div id="fileHeader">
|
||||
<h1>time_portuguese.rb</h1>
|
||||
<table class="header-table">
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Path:</strong></td>
|
||||
<td>vendor/plugins/brazilian-rails/lib/time_portuguese.rb
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="top-aligned-row">
|
||||
<td><strong>Last Update:</strong></td>
|
||||
<td>Thu Sep 27 15:02:53 -0300 2007</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- banner header -->
|
||||
|
||||
<div id="bodyContent">
|
||||
|
||||
|
||||
|
||||
<div id="contextContent">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- if includes -->
|
||||
|
||||
<div id="section">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- if method_list -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="validator-badges">
|
||||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,45 +0,0 @@
|
||||
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Classes
|
||||
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Classes</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
||||
<base target="docwin" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="index">
|
||||
<h1 class="section-bar">Classes</h1>
|
||||
<div id="index-entries">
|
||||
<a href="classes/ActionView.html">ActionView</a><br />
|
||||
<a href="classes/ActionView/Helpers.html">ActionView::Helpers</a><br />
|
||||
<a href="classes/ActionView/Helpers/ActiveRecordHelper.html">ActionView::Helpers::ActiveRecordHelper</a><br />
|
||||
<a href="classes/ActionView/Helpers/DateHelper.html">ActionView::Helpers::DateHelper</a><br />
|
||||
<a href="classes/ActiveRecord.html">ActiveRecord</a><br />
|
||||
<a href="classes/ActiveRecord/Errors.html">ActiveRecord::Errors</a><br />
|
||||
<a href="classes/ActiveSupport.html">ActiveSupport</a><br />
|
||||
<a href="classes/ActiveSupport/CoreExtensions.html">ActiveSupport::CoreExtensions</a><br />
|
||||
<a href="classes/ActiveSupport/CoreExtensions/String.html">ActiveSupport::CoreExtensions::String</a><br />
|
||||
<a href="classes/ActiveSupport/CoreExtensions/String/Conversions.html">ActiveSupport::CoreExtensions::String::Conversions</a><br />
|
||||
<a href="classes/Date.html">Date</a><br />
|
||||
<a href="classes/Dinheiro.html">Dinheiro</a><br />
|
||||
<a href="classes/DinheiroUtil.html">DinheiroUtil</a><br />
|
||||
<a href="classes/Extenso.html">Extenso</a><br />
|
||||
<a href="classes/ExtensoReal.html">ExtensoReal</a><br />
|
||||
<a href="classes/Inflector.html">Inflector</a><br />
|
||||
<a href="classes/NilClass.html">NilClass</a><br />
|
||||
<a href="classes/StringPortuguese.html">StringPortuguese</a><br />
|
||||
<a href="classes/Time.html">Time</a><br />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,37 +0,0 @@
|
||||
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Files
|
||||
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Files</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
||||
<base target="docwin" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="index">
|
||||
<h1 class="section-bar">Files</h1>
|
||||
<div id="index-entries">
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/action_view_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/action_view_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/active_record_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/active_record_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/date_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/date_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/dinheiro_rb.html">vendor/plugins/brazilian-rails/lib/dinheiro.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/dinheiro_util_rb.html">vendor/plugins/brazilian-rails/lib/dinheiro_util.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/excecoes_rb.html">vendor/plugins/brazilian-rails/lib/excecoes.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/inflector_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/inflector_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/nil_class_rb.html">vendor/plugins/brazilian-rails/lib/nil_class.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/number_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/number_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/string_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/string_portuguese.rb</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/time_portuguese_rb.html">vendor/plugins/brazilian-rails/lib/time_portuguese.rb</a><br />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,71 +0,0 @@
|
||||
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Methods
|
||||
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Methods</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
||||
<base target="docwin" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="index">
|
||||
<h1 class="section-bar">Methods</h1>
|
||||
<div id="index-entries">
|
||||
<a href="classes/Dinheiro.html#M000009">* (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000007">+ (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000008">- (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000010">/ (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000006"><=> (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000005">== (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000015">coerce (Dinheiro)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000043">contabil (DinheiroUtil)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000020">contabil (Dinheiro)</a><br />
|
||||
<a href="files/vendor/plugins/brazilian-rails/lib/excecoes_rb.html#M000001">cria_excecao (vendor/plugins/brazilian-rails/lib/excecoes.rb)</a><br />
|
||||
<a href="classes/ActionView/Helpers/DateHelper.html#M000034">distance_of_time_in_words (ActionView::Helpers::DateHelper)</a><br />
|
||||
<a href="classes/ActionView/Helpers/ActiveRecordHelper.html#M000033">error_messages_for (ActionView::Helpers::ActiveRecordHelper)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000003">new (Dinheiro)</a><br />
|
||||
<a href="classes/StringPortuguese.html#M000044">nome_proprio (StringPortuguese)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000038">para_dinheiro (DinheiroUtil)</a><br />
|
||||
<a href="classes/NilClass.html#M000024">para_dinheiro (NilClass)</a><br />
|
||||
<a href="classes/Extenso.html#M000035">por_extenso (Extenso)</a><br />
|
||||
<a href="classes/Extenso.html#M000037">por_extenso (Extenso)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000011">por_extenso (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000012">por_extenso_em_reais (Dinheiro)</a><br />
|
||||
<a href="classes/ExtensoReal.html#M000030">por_extenso_em_reais (ExtensoReal)</a><br />
|
||||
<a href="classes/ExtensoReal.html#M000032">por_extenso_em_reais (ExtensoReal)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000039">reais (DinheiroUtil)</a><br />
|
||||
<a href="classes/NilClass.html#M000025">reais (NilClass)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000018">reais (Dinheiro)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000042">reais_contabeis (DinheiroUtil)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000019">reais_contabeis (Dinheiro)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000040">real (DinheiroUtil)</a><br />
|
||||
<a href="classes/NilClass.html#M000026">real (NilClass)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000016">real (Dinheiro)</a><br />
|
||||
<a href="classes/DinheiroUtil.html#M000041">real_contabil (DinheiroUtil)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000017">real_contabil (Dinheiro)</a><br />
|
||||
<a href="classes/StringPortuguese.html#M000045">remover_acentos (StringPortuguese)</a><br />
|
||||
<a href="classes/ActiveSupport/CoreExtensions/String/Conversions.html#M000029">to_date (ActiveSupport::CoreExtensions::String::Conversions)</a><br />
|
||||
<a href="classes/Extenso.html#M000036">to_extenso (Extenso)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000013">to_extenso (Dinheiro)</a><br />
|
||||
<a href="classes/ExtensoReal.html#M000031">to_extenso_real (ExtensoReal)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000014">to_f (Dinheiro)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000004">to_s (Dinheiro)</a><br />
|
||||
<a href="classes/Time.html#M000002">to_s_br (Time)</a><br />
|
||||
<a href="classes/Date.html#M000027">to_s_br (Date)</a><br />
|
||||
<a href="classes/Date.html#M000028">valid? (Date)</a><br />
|
||||
<a href="classes/NilClass.html#M000022">valor (NilClass)</a><br />
|
||||
<a href="classes/NilClass.html#M000023">valor_contabil (NilClass)</a><br />
|
||||
<a href="classes/Dinheiro.html#M000021">valor_decimal (Dinheiro)</a><br />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Brazilian Rails Plugin Documentation
|
||||
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Brazilian Rails Plugin Documentation</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
</head>
|
||||
<frameset rows="20%, 80%">
|
||||
<frameset cols="25%,35%,45%">
|
||||
<frame src="fr_file_index.html" title="Files" name="Files" />
|
||||
<frame src="fr_class_index.html" name="Classes" />
|
||||
<frame src="fr_method_index.html" name="Methods" />
|
||||
</frameset>
|
||||
<frame src="start.html" name="docwin" />
|
||||
</frameset>
|
||||
</html>
|
@ -1,208 +0,0 @@
|
||||
|
||||
body {
|
||||
font-family: Verdana,Arial,Helvetica,sans-serif;
|
||||
font-size: 90%;
|
||||
margin: 0;
|
||||
margin-left: 40px;
|
||||
padding: 0;
|
||||
background: white;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
|
||||
h1 { font-size: 150%; }
|
||||
h2,h3,h4 { margin-top: 1em; }
|
||||
|
||||
a { background: #eef; color: #039; text-decoration: none; }
|
||||
a:hover { background: #039; color: #eef; }
|
||||
|
||||
/* Override the base stylesheet's Anchor inside a table cell */
|
||||
td > a {
|
||||
background: transparent;
|
||||
color: #039;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* and inside a section title */
|
||||
.section-title > a {
|
||||
background: transparent;
|
||||
color: #eee;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* === Structural elements =================================== */
|
||||
|
||||
div#index {
|
||||
margin: 0;
|
||||
margin-left: -40px;
|
||||
padding: 0;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
|
||||
div#index a {
|
||||
margin-left: 0.7em;
|
||||
}
|
||||
|
||||
div#index .section-bar {
|
||||
margin-left: 0px;
|
||||
padding-left: 0.7em;
|
||||
background: #ccc;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
div#classHeader, div#fileHeader {
|
||||
width: auto;
|
||||
color: white;
|
||||
padding: 0.5em 1.5em 0.5em 1.5em;
|
||||
margin: 0;
|
||||
margin-left: -40px;
|
||||
border-bottom: 3px solid #006;
|
||||
}
|
||||
|
||||
div#classHeader a, div#fileHeader a {
|
||||
background: inherit;
|
||||
color: white;
|
||||
}
|
||||
|
||||
div#classHeader td, div#fileHeader td {
|
||||
background: inherit;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
div#fileHeader {
|
||||
background: #057;
|
||||
}
|
||||
|
||||
div#classHeader {
|
||||
background: #048;
|
||||
}
|
||||
|
||||
|
||||
.class-name-in-header {
|
||||
font-size: 180%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
div#bodyContent {
|
||||
padding: 0 1.5em 0 1.5em;
|
||||
}
|
||||
|
||||
div#description {
|
||||
padding: 0.5em 1.5em;
|
||||
background: #efefef;
|
||||
border: 1px dotted #999;
|
||||
}
|
||||
|
||||
div#description h1,h2,h3,h4,h5,h6 {
|
||||
color: #125;;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
div#validator-badges {
|
||||
text-align: center;
|
||||
}
|
||||
div#validator-badges img { border: 0; }
|
||||
|
||||
div#copyright {
|
||||
color: #333;
|
||||
background: #efefef;
|
||||
font: 0.75em sans-serif;
|
||||
margin-top: 5em;
|
||||
margin-bottom: 0;
|
||||
padding: 0.5em 2em;
|
||||
}
|
||||
|
||||
|
||||
/* === Classes =================================== */
|
||||
|
||||
table.header-table {
|
||||
color: white;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.type-note {
|
||||
font-size: small;
|
||||
color: #DEDEDE;
|
||||
}
|
||||
|
||||
.xxsection-bar {
|
||||
background: #eee;
|
||||
color: #333;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.section-bar {
|
||||
color: #333;
|
||||
border-bottom: 1px solid #999;
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
|
||||
.section-title {
|
||||
background: #79a;
|
||||
color: #eee;
|
||||
padding: 3px;
|
||||
margin-top: 2em;
|
||||
margin-left: -30px;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.top-aligned-row { vertical-align: top }
|
||||
.bottom-aligned-row { vertical-align: bottom }
|
||||
|
||||
/* --- Context section classes ----------------------- */
|
||||
|
||||
.context-row { }
|
||||
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
|
||||
.context-item-value { font-size: small; color: #448; }
|
||||
.context-item-desc { color: #333; padding-left: 2em; }
|
||||
|
||||
/* --- Method classes -------------------------- */
|
||||
.method-detail {
|
||||
background: #efefef;
|
||||
padding: 0;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 1em;
|
||||
border: 1px dotted #ccc;
|
||||
}
|
||||
.method-heading {
|
||||
color: black;
|
||||
background: #ccc;
|
||||
border-bottom: 1px solid #666;
|
||||
padding: 0.2em 0.5em 0 0.5em;
|
||||
}
|
||||
.method-signature { color: black; background: inherit; }
|
||||
.method-name { font-weight: bold; }
|
||||
.method-args { font-style: italic; }
|
||||
.method-description { padding: 0 0.5em 0 0.5em; }
|
||||
|
||||
/* --- Source code sections -------------------- */
|
||||
|
||||
a.source-toggle { font-size: 90%; }
|
||||
div.method-source-code {
|
||||
background: #262626;
|
||||
color: #ffdead;
|
||||
margin: 1em;
|
||||
padding: 0.5em;
|
||||
border: 1px dashed #999;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
||||
|
||||
/* --- Ruby keyword styles --------------------- */
|
||||
|
||||
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
|
||||
|
||||
.ruby-constant { color: #7fffd4; background: transparent; }
|
||||
.ruby-keyword { color: #00ffff; background: transparent; }
|
||||
.ruby-ivar { color: #eedd82; background: transparent; }
|
||||
.ruby-operator { color: #00ffee; background: transparent; }
|
||||
.ruby-identifier { color: #ffdead; background: transparent; }
|
||||
.ruby-node { color: #ffa07a; background: transparent; }
|
||||
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
||||
.ruby-regexp { color: #ffa07a; background: transparent; }
|
||||
.ruby-value { color: #7fffd4; background: transparent; }
|
@ -1,39 +0,0 @@
|
||||
Para maiores exemplos olhe os testes.<br/>
|
||||
<br/>
|
||||
Para usar a as regras de plural em português basta adicionar a linha acima no seu enviroment.rb
|
||||
<br/>
|
||||
To use the inflector in portuguese add this line to your enviroment.rb
|
||||
<br/>
|
||||
require 'inflector_portuguese'<br/>
|
||||
<br/>
|
||||
"2007/01/02".to_date<br/>
|
||||
"13/12/2007".to_date<br/>
|
||||
"01-02-2007".to_date<br/>
|
||||
<br/>
|
||||
"01/02/2007".to_date.to_s returns "2007-02-01"<br/>
|
||||
<br/>
|
||||
"13/12/2007".to_date.to_s_br returns "13/12/2007"<br/>
|
||||
<br/>
|
||||
Date.valid?("2007/01/02") returns true<br/>
|
||||
Date.valid?("13/12/2007") returns true<br/>
|
||||
<br/>
|
||||
Date.valid?("13/12/200A") returns false<br/>
|
||||
Date.valid?("00/00/0000") returns false<br/>
|
||||
Para ver os usos da parte de dinheiro recomendo olhar o arquivo dinheiro_test.<br/>
|
||||
<br/>
|
||||
<pre>
|
||||
"832.to_extenso => #{832.to_extenso}"
|
||||
"125623.to_extenso => #{125623.to_extenso}"
|
||||
"1_968_854_823.to_extenso => #{1_968_854_823.to_extenso}"
|
||||
"45_233_968_854_823.to_extenso => #{45_233_968_854_823.to_extenso}"
|
||||
|
||||
"1230.to_extenso_real => #{1230.to_extenso_real}"
|
||||
"1230.95.to_extenso_real => #{1230.95.to_extenso_real}"
|
||||
"1.50.to_extenso_real => #{1.50.to_extenso_real}"
|
||||
"832.01.to_extenso_real => #{832.01.to_extenso_real}"
|
||||
</pre>
|
||||
<br/>
|
||||
<pre>
|
||||
'maria de andrade dos santos e silva'.nome_proprio() => 'Maria de Andrade dos Santos e Silva'
|
||||
'este texto está com acentuação'.remover_acentos => 'este texto esta com acentuacao'
|
||||
</pre>
|
@ -1,27 +0,0 @@
|
||||
require 'active_record_portuguese'
|
||||
require 'action_view_portuguese'
|
||||
require 'date_portuguese'
|
||||
require 'time_portuguese'
|
||||
require 'dinheiro'
|
||||
require 'dinheiro_util'
|
||||
require 'excecoes'
|
||||
require 'nil_class'
|
||||
require 'number_portuguese'
|
||||
require 'string_portuguese'
|
||||
|
||||
Numeric.send(:include, DinheiroUtil)
|
||||
Numeric.send(:include, ExtensoReal)
|
||||
String.send(:include, DinheiroUtil)
|
||||
String.send(:include, StringPortuguese)
|
||||
|
||||
old_verbose = $VERBOSE
|
||||
$VERBOSE = nil
|
||||
[Time, Date].each do |clazz|
|
||||
eval "#{clazz}::MONTHNAMES = [nil] + %w(Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro)"
|
||||
eval "#{clazz}::DAYNAMES = %w(Domingo Segunda-Feira Terca-Feira Quarta-Feira Quinta-Feira Sexta-Feira Sabado)"
|
||||
eval "#{clazz}::ABBR_MONTHNAMES = [nil] + %w(Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez)"
|
||||
eval "#{clazz}::ABBR_DAYNAMES = %w(Dom Seg Ter Qua Qui Sex Sab)"
|
||||
end
|
||||
$VERBOSE = old_verbose
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
# Install hook code here
|
@ -1,64 +0,0 @@
|
||||
module ActionView::Helpers::ActiveRecordHelper
|
||||
# Traduz as mensagens de erro do ActiveRecord
|
||||
def error_messages_for(*params)
|
||||
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
|
||||
objects = params.collect { |object_name| instance_variable_get('@'+object_name.to_s()) }
|
||||
objects.compact!
|
||||
count = objects.inject(0) {|sum, object| sum + object.errors.count }
|
||||
unless count.zero?
|
||||
html = {}
|
||||
[:id, :class].each do |key|
|
||||
if options.include?(key)
|
||||
value = options[key]
|
||||
html[key] = value unless value.blank?
|
||||
else
|
||||
html[key] = 'errorExplanation'
|
||||
end
|
||||
end
|
||||
header_message = "#{pluralize(count, 'erro')} para #{(options[:object_name] || params.first).to_s.gsub('_', ' ')}"
|
||||
error_messages = objects.map { |object| object.errors.full_messages.map {|msg| content_tag(:li, msg) } }
|
||||
content_tag(:div,
|
||||
content_tag(options[:header_tag] || :h2, header_message) <<
|
||||
content_tag(:p, 'Foram detectados os seguintes erros:') <<
|
||||
content_tag(:ul, error_messages),
|
||||
html
|
||||
)
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ActionView::Helpers::DateHelper
|
||||
# Traduz o método distance_of_time_in_words para retornar esse valor em português
|
||||
#
|
||||
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
|
||||
from_time = from_time.to_time if from_time.respond_to?(:to_time)
|
||||
to_time = to_time.to_time if to_time.respond_to?(:to_time)
|
||||
distance_in_minutes = (((to_time - from_time).abs)/60).round
|
||||
distance_in_seconds = ((to_time - from_time).abs).round
|
||||
|
||||
case distance_in_minutes
|
||||
when 0..1
|
||||
return (distance_in_minutes == 0) ? 'menos de um minuto' : '1 minuto' unless include_seconds
|
||||
case distance_in_seconds
|
||||
when 0..4 then 'menos de 5 segundos'
|
||||
when 5..9 then 'menos de 10 segundos'
|
||||
when 10..19 then 'menos de 20 segundos'
|
||||
when 20..39 then 'meio minuto'
|
||||
when 40..59 then 'menos de um minuto'
|
||||
else '1 minuto'
|
||||
end
|
||||
|
||||
when 2..44 then "#{distance_in_minutes} minutos"
|
||||
when 45..89 then 'aproximadamente 1 hora'
|
||||
when 90..1439 then "aproximadamente #{(distance_in_minutes.to_f / 60.0).round} horas"
|
||||
when 1440..2879 then '1 dia'
|
||||
when 2880..43199 then "#{(distance_in_minutes / 1440).round} dias"
|
||||
when 43200..86399 then 'aproximadamente 1 mês'
|
||||
when 86400..525959 then "#{(distance_in_minutes / 43200).round} meses"
|
||||
when 525960..1051919 then 'aproximadamente 1 ano'
|
||||
else "mais de #{(distance_in_minutes / 525960).round} anos"
|
||||
end
|
||||
end
|
||||
end
|
@ -1,19 +0,0 @@
|
||||
module ActiveRecord
|
||||
# Traduz as mensagens de erro do ActiveRecord
|
||||
class Errors
|
||||
@@default_error_messages = {
|
||||
:inclusion => "não está incluído na lista",
|
||||
:exclusion => "está reservado",
|
||||
:invalid => "é inválido.",
|
||||
:confirmation => "não corresponde à confirmação",
|
||||
:accepted => "deve ser aceito",
|
||||
:empty => "não pode estar vazio",
|
||||
:blank => "não pode estar em branco",
|
||||
:too_long => "muito longo (máximo %d caracteres)",
|
||||
:too_short => "muito curto (mínimo %d caracteres)",
|
||||
:wrong_length => "de comprimento errado (deveria ter %d caracteres)",
|
||||
:taken => "já está em uso",
|
||||
:not_a_number => "não é um número"
|
||||
}
|
||||
end
|
||||
end
|
@ -1,40 +0,0 @@
|
||||
module ActiveSupport::CoreExtensions::String::Conversions
|
||||
# Cria a data no padrao brasileiro e permanece aceitando no formato tradicional.
|
||||
#
|
||||
# Exemplo:
|
||||
# "27/09/2007".to_date
|
||||
def to_date
|
||||
if /(\d{1,2})\W(\d{1,2})\W(\d{4})/ =~ self
|
||||
::Date.new($3.to_i, $2.to_i, $1.to_i)
|
||||
else
|
||||
::Date.new(*ParseDate.parsedate(self)[0..2])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Date
|
||||
# Retorna a data no padrao brasileiro
|
||||
#
|
||||
# Exemplo:
|
||||
# data = Date.new(2007, 9, 27)
|
||||
# data.to_s_br ==> "27/09/2007"
|
||||
def to_s_br
|
||||
strftime("%d/%m/%Y")
|
||||
end
|
||||
|
||||
# Valida se uma string eh uma data valida
|
||||
#
|
||||
# Exemplo:
|
||||
# Date.valid?('01/01/2007') ==> true
|
||||
# Date.valid?('32/01/2007') ==> false
|
||||
def self.valid?(date)
|
||||
begin
|
||||
date = date.to_date
|
||||
Date.valid_civil?(date.year, date.month, date.day)
|
||||
rescue
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
end
|
@ -1,243 +0,0 @@
|
||||
class Dinheiro
|
||||
|
||||
include Comparable
|
||||
|
||||
attr_reader :quantia
|
||||
|
||||
FORMATO_VALIDO_BR = /^([R|r]\$\s*)?(([+-]?\d{1,3}(\.?\d{3})*))?(\,\d{0,2})?$/
|
||||
FORMATO_VALIDO_EUA = /^([R|r]\$\s*)?(([+-]?\d{1,3}(\,?\d{3})*))?(\.\d{0,2})?$/
|
||||
SEPARADOR_MILHAR = "."
|
||||
SEPARADOR_FRACIONARIO = ","
|
||||
QUANTIDADE_DIGITOS = 3
|
||||
PRECISAO_DECIMAL = 100
|
||||
|
||||
def initialize(quantia)
|
||||
self.quantia = quantia
|
||||
end
|
||||
|
||||
# Retorna o valor armazenado em string.
|
||||
#
|
||||
# Exemplo:
|
||||
# 1000.to_s ==> '1.000,00'
|
||||
def to_s
|
||||
inteiro_com_milhar(parte_inteira) + parte_decimal
|
||||
end
|
||||
|
||||
# Compara com outro dinheiro se eh igual.
|
||||
#
|
||||
# Exemplo:
|
||||
# um_real = Dinheiro.new(1)
|
||||
# um_real == Dinheiro.new(1) ==> true
|
||||
# um_real == Dinheiro.new(2) ==> false
|
||||
def ==(outro_dinheiro)
|
||||
outro_dinheiro = Dinheiro.new(outro_dinheiro) unless outro_dinheiro.kind_of?(Dinheiro)
|
||||
@quantia == outro_dinheiro.quantia
|
||||
end
|
||||
|
||||
# Compara com outro dinheiro se eh maior ou menor.
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.real < 2.reais ==> true
|
||||
# 1.real > 2.reais ==> false
|
||||
# 2.real < 1.reais ==> false
|
||||
# 2.real > 1.reais ==> true
|
||||
def <=>(outro_dinheiro)
|
||||
outro_dinheiro = Dinheiro.new(outro_dinheiro) unless outro_dinheiro.kind_of?(Dinheiro)
|
||||
@quantia <=> outro_dinheiro.quantia
|
||||
end
|
||||
|
||||
# Retorna a adicao entre dinheiros.
|
||||
def +(outro)
|
||||
Dinheiro.new(transforma_em_string_que_represente_a_quantia(@quantia + quantia_de(outro)))
|
||||
end
|
||||
|
||||
# Retorna a subtracao entre dinheiros.
|
||||
def -(outro)
|
||||
Dinheiro.new(transforma_em_string_que_represente_a_quantia(@quantia - quantia_de(outro)))
|
||||
end
|
||||
|
||||
# Retorna a multiplicacao entre dinheiros.
|
||||
def *(outro)
|
||||
return Dinheiro.new(to_f * outro) unless outro.kind_of? Dinheiro
|
||||
outro * to_f
|
||||
end
|
||||
|
||||
# Retorna a divisao entre dinheiros.
|
||||
def /(outro)
|
||||
raise DivisaPorNaoEscalarError unless outro.kind_of?(Numeric)
|
||||
return @quantia/outro if outro == 0
|
||||
soma_parcial = Dinheiro.new(0)
|
||||
parcelas = []
|
||||
(outro-1).times do
|
||||
parcela = Dinheiro.new(transforma_em_string_que_represente_a_quantia(@quantia/outro))
|
||||
parcelas << parcela
|
||||
soma_parcial += parcela
|
||||
end
|
||||
parcelas << Dinheiro.new(transforma_em_string_que_represente_a_quantia(@quantia - quantia_de(soma_parcial)))
|
||||
end
|
||||
|
||||
# Escreve o valor por extenso.
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.real.por_extenso ==> 'um real'
|
||||
# (100.58).por_extenso ==> 'cem reais e cinquenta e oito centavos'
|
||||
def por_extenso
|
||||
(@quantia/100.0).por_extenso_em_reais
|
||||
end
|
||||
|
||||
# Alias para o metodo por_extenso.
|
||||
alias_method :por_extenso_em_reais, :por_extenso
|
||||
|
||||
# DEPRECATION WARNING: use por_extenso ou por_extenso_em_reais, pois este sera removido no proximo release.
|
||||
def to_extenso
|
||||
warn("DEPRECATION WARNING: use por_extenso ou por_extenso_em_reais, pois este sera removido no proximo release.")
|
||||
self.por_extenso
|
||||
end
|
||||
|
||||
# Retorna um Float.
|
||||
def to_f
|
||||
to_s.gsub(',', '.').to_f
|
||||
end
|
||||
|
||||
def coerce(outro)
|
||||
[ Dinheiro.new(outro), self ]
|
||||
end
|
||||
|
||||
# Retorna uma string formatada em valor monetario.
|
||||
#
|
||||
# Exemplo:
|
||||
# Dinheiro.new(1).real ==> 'R$ 1,00'
|
||||
# Dinheiro.new(-1).real ==> 'R$ -1,00'
|
||||
def real
|
||||
"R$ " + to_s
|
||||
end
|
||||
|
||||
# Retorna uma string formatada em valor monetario.
|
||||
#
|
||||
# Exemplo:
|
||||
# Dinheiro.new(1).real ==> 'R$ 1,00'
|
||||
# Dinheiro.new(-1).real ==> 'R$ (1,00)'
|
||||
def real_contabil
|
||||
"R$ " + contabil
|
||||
end
|
||||
|
||||
# Alias para real.
|
||||
alias_method :reais, :real
|
||||
|
||||
# Alias para real_contabil.
|
||||
alias_method :reais_contabeis, :real_contabil
|
||||
|
||||
# Retorna uma string formatada.
|
||||
#
|
||||
# Exemplo:
|
||||
# Dinheiro.new(1).contabil ==> '1,00'
|
||||
# Dinheiro.new(-1).contabil ==> '(1,00)'
|
||||
def contabil
|
||||
if @quantia >= 0
|
||||
to_s
|
||||
else
|
||||
"(" + to_s[1..-1] + ")"
|
||||
end
|
||||
end
|
||||
|
||||
# Retorna um BigDecinal.
|
||||
def valor_decimal
|
||||
BigDecimal.new quantia_sem_separacao_milhares.gsub(',','.')
|
||||
end
|
||||
|
||||
private
|
||||
def quantia_de(outro)
|
||||
outro = outro.to_f if outro.kind_of?(BigDecimal)
|
||||
return outro.quantia if outro.kind_of?(Dinheiro)
|
||||
(outro * 100).round
|
||||
end
|
||||
|
||||
def transforma_em_string_que_represente_a_quantia(quantia)
|
||||
if /^([+-]?)(\d)$/ =~ quantia.to_s
|
||||
return "#{$1}0.0#{$2}"
|
||||
end
|
||||
/^([+-]?)(\d*)(\d\d)$/ =~ quantia.to_s
|
||||
"#{$1}#{$2.to_i}.#{$3}"
|
||||
end
|
||||
|
||||
def quantia=(quantia)
|
||||
raise DinheiroInvalidoError unless quantia_valida?(quantia)
|
||||
quantia = quantia.to_f if quantia.kind_of?(BigDecimal)
|
||||
@quantia = (quantia * 100).round if quantia.kind_of?(Numeric)
|
||||
@quantia = extrai_quantia_como_inteiro(quantia) if quantia.kind_of?(String)
|
||||
end
|
||||
|
||||
def parte_inteira
|
||||
quantia_sem_separacao_milhares[0,quantia_sem_separacao_milhares.length-QUANTIDADE_DIGITOS]
|
||||
end
|
||||
|
||||
def parte_decimal
|
||||
quantia_sem_separacao_milhares[-QUANTIDADE_DIGITOS, QUANTIDADE_DIGITOS]
|
||||
end
|
||||
|
||||
def inteiro_com_milhar(inteiro)
|
||||
return inteiro if quantidade_de_passos(inteiro) == 0
|
||||
resultado = ""
|
||||
quantidade_de_passos(inteiro).times do |passo|
|
||||
resultado = "." + inteiro[-QUANTIDADE_DIGITOS + passo * -QUANTIDADE_DIGITOS, QUANTIDADE_DIGITOS] + resultado
|
||||
end
|
||||
resultado = inteiro[0, digitos_que_sobraram(inteiro)] + resultado
|
||||
resultado.gsub(/^(-?)\./, '\1')
|
||||
end
|
||||
|
||||
def quantia_sem_separacao_milhares
|
||||
sprintf("%.2f", (@quantia.to_f / PRECISAO_DECIMAL)).gsub(SEPARADOR_MILHAR, SEPARADOR_FRACIONARIO)
|
||||
end
|
||||
|
||||
def quantidade_de_passos(inteiro)
|
||||
resultado = inteiro.length / QUANTIDADE_DIGITOS
|
||||
resultado = (resultado - 1) if inteiro.length % QUANTIDADE_DIGITOS == 0
|
||||
resultado
|
||||
end
|
||||
|
||||
def digitos_que_sobraram(inteiro)
|
||||
inteiro.length - (quantidade_de_passos(inteiro) * QUANTIDADE_DIGITOS)
|
||||
end
|
||||
|
||||
def quantia_valida?(quantia)
|
||||
return false if quantia.kind_of?(String) && !quantia_respeita_formato?(quantia)
|
||||
quantia.kind_of?(String) || quantia.kind_of?(Numeric)
|
||||
end
|
||||
|
||||
def extrai_quantia_como_inteiro(quantia)
|
||||
if FORMATO_VALIDO_BR =~ quantia
|
||||
return sem_milhar($2, $5, '.')
|
||||
end
|
||||
if FORMATO_VALIDO_EUA =~ quantia
|
||||
return sem_milhar($2, $5, ',')
|
||||
end
|
||||
end
|
||||
|
||||
def sem_milhar(parte_inteira, parte_decimal, delimitador_de_milhar)
|
||||
(inteiro(parte_inteira, delimitador_de_milhar) + decimal(parte_decimal)).to_i
|
||||
end
|
||||
|
||||
def inteiro(inteiro_com_separador_milhar, separador)
|
||||
return inteiro_com_separador_milhar.gsub(separador, '') unless inteiro_com_separador_milhar.blank?
|
||||
""
|
||||
end
|
||||
|
||||
def decimal(parte_fracionaria)
|
||||
unless parte_fracionaria.blank?
|
||||
return sem_delimitador_decimal(parte_fracionaria) if parte_fracionaria.length == 3
|
||||
return sem_delimitador_decimal(parte_fracionaria) + "0" if parte_fracionaria.length == 2
|
||||
end
|
||||
"00"
|
||||
end
|
||||
|
||||
def sem_delimitador_decimal(parte_fracionaria)
|
||||
"#{parte_fracionaria}".gsub(/[.|,]/, '')
|
||||
end
|
||||
|
||||
|
||||
def quantia_respeita_formato?(quantia)
|
||||
return true if FORMATO_VALIDO_BR.match(quantia) || FORMATO_VALIDO_EUA.match(quantia)
|
||||
false
|
||||
end
|
||||
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
module DinheiroUtil
|
||||
# Transforma numero em dinheiro
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.para_dinheiro.class ==> Dinheiro
|
||||
def para_dinheiro
|
||||
Dinheiro.new(self)
|
||||
end
|
||||
|
||||
# Alias para para_dinheiro
|
||||
alias_method :reais, :para_dinheiro
|
||||
|
||||
# Alias para para_dinheiro
|
||||
alias_method :real, :para_dinheiro
|
||||
|
||||
# Retorna string formatada com simbolo monetario
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.real_contabil ==> 'R$ 1,00'
|
||||
# -1.real_contabil ==> 'R$ (1,00)'
|
||||
def real_contabil
|
||||
Dinheiro.new(self).real_contabil
|
||||
end
|
||||
|
||||
# Retorna string formatada com simbolo monetario
|
||||
#
|
||||
# Exemplo:
|
||||
# 2.reais_contabeis ==> 'R$ 2,00'
|
||||
# -2.reais_contabeis ==> 'R$ 2,00'
|
||||
def reais_contabeis
|
||||
Dinheiro.new(self).reais_contabeis
|
||||
end
|
||||
|
||||
# Retorna string formatada com simbolo monetario
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.contabil ==> '1,00'
|
||||
# -1.contabil ==> '(1,00)'
|
||||
def contabil
|
||||
Dinheiro.new(self).contabil
|
||||
end
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
def cria_excecao(classe, mensagem)
|
||||
eval "class #{classe}; def initialize; super('#{mensagem}'); end; end"
|
||||
end
|
||||
|
||||
cria_excecao("DinheiroInvalidoError < ArgumentError", "O valor deve estar preenchido e no formato correto. Ex.: 100.00 .")
|
||||
cria_excecao("DivisaPorNaoEscalarError < ArgumentError", "So eh possivel dividir dinheiro por numeros.")
|
||||
|
@ -1,45 +0,0 @@
|
||||
module Inflector
|
||||
Inflector.inflections do |inflect|
|
||||
inflect.plural /^([a-zA-z]*)r$/i, '\1res'
|
||||
inflect.plural /^([a-zA-z]*)z$/i, '\1zes'
|
||||
|
||||
inflect.plural /^([a-zA-z]*)al$/i, '\1ais'
|
||||
inflect.plural /^([a-zA-z]*)el$/i, '\1eis'
|
||||
inflect.plural /^([a-zA-z]*)ol$/i, '\1ois'
|
||||
inflect.plural /^([a-zA-z]*)ul$/i, '\1uis'
|
||||
|
||||
inflect.plural /^([a-zA-z]*)il$/i, '\1is'
|
||||
|
||||
inflect.plural /^([a-zA-z]*)m$/i, '\1ns'
|
||||
|
||||
inflect.plural /^([a-zA-z]*)([aeiou]s)$/i, '\1\2es'
|
||||
|
||||
inflect.plural /^([a-zA-z]*)ão$/i, '\1ões'
|
||||
|
||||
inflect.singular /^([a-zA-z]*)as$/i, '\1a'
|
||||
inflect.singular /^([a-zA-z]*)es$/i, '\1e'
|
||||
inflect.singular /^([a-zA-z]*)is$/i, '\1i'
|
||||
inflect.singular /^([a-zA-z]*)os$/i, '\1o'
|
||||
inflect.singular /^([a-zA-z]*)us$/i, '\1u'
|
||||
|
||||
inflect.singular /^([a-zA-z]*)res$/i, '\1r'
|
||||
inflect.singular /^([a-zA-z]*)zes$/i, '\1z'
|
||||
|
||||
inflect.singular /^([a-zA-z]*)ais$/i, '\1al'
|
||||
inflect.singular /^([a-zA-z]*)eis$/i, '\1el'
|
||||
inflect.singular /^([a-zA-z]*)ois$/i, '\1ol'
|
||||
inflect.singular /^([a-zA-z]*)uis$/i, '\1ul'
|
||||
|
||||
inflect.singular /^([a-zA-z]*)ns$/i, '\1m'
|
||||
inflect.singular /^([a-zA-z]*)ões$/i, '\1ão'
|
||||
inflect.singular /^([a-zA-z]*)ães$/i, '\1ão'
|
||||
inflect.singular /^([a-zA-z]*)ãos$/i, '\1ão'
|
||||
|
||||
inflect.irregular 'cão', 'cães'
|
||||
inflect.irregular 'pão', 'pães'
|
||||
inflect.irregular 'mão', 'mãos'
|
||||
inflect.irregular 'alemão', 'alemães'
|
||||
|
||||
inflect.uncountable %w( tennis torax )
|
||||
end
|
||||
end
|
@ -1,24 +0,0 @@
|
||||
class NilClass
|
||||
|
||||
def valor
|
||||
""
|
||||
end
|
||||
|
||||
def valor_contabil
|
||||
""
|
||||
end
|
||||
|
||||
def para_dinheiro
|
||||
""
|
||||
end
|
||||
|
||||
def reais
|
||||
""
|
||||
end
|
||||
|
||||
def real
|
||||
""
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,158 +0,0 @@
|
||||
module Extenso
|
||||
@@unidade = {
|
||||
0 => "zero",
|
||||
1 => "um",
|
||||
2 => "dois",
|
||||
3 => "três",
|
||||
4 => "quatro",
|
||||
5 => "cinco",
|
||||
6 => "seis",
|
||||
7 => "sete",
|
||||
8 => "oito",
|
||||
9 => "nove"
|
||||
}
|
||||
@@dezena = {
|
||||
10 => "dez",
|
||||
11 => "onze",
|
||||
12 => "doze",
|
||||
13 => "treze",
|
||||
14 => "quatorze",
|
||||
15 => "quinze",
|
||||
16 => "dezesseis",
|
||||
17 => "dezessete",
|
||||
18 => "dezoito",
|
||||
19 => "dezenove",
|
||||
20 => "vinte",
|
||||
30 => "trinta",
|
||||
40 => "quarenta",
|
||||
50 => "cinquenta",
|
||||
60 => "sessenta",
|
||||
70 => "setenta",
|
||||
80 => "oitenta",
|
||||
90 => "noventa" }
|
||||
@@centena = {100 => "cento",
|
||||
200 => "duzentos",
|
||||
300 => "trezentos",
|
||||
400 => "quatrocentos",
|
||||
500 => "quinhentos",
|
||||
600 => "seiscentos",
|
||||
700 => "setecentos",
|
||||
800 => "oitocentos",
|
||||
900 => "novecentos" }
|
||||
|
||||
# Escreve o numero por extenso.
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.por_extenso ==> 'um'
|
||||
# 100.por_extenso ==> 'cem'
|
||||
# 158.por_extenso ==> 'cento e cinquenta e oito'
|
||||
def por_extenso
|
||||
Extenso.por_extenso(self)
|
||||
end
|
||||
|
||||
# DEPRECATION WARNING: use por_extenso, pois este sera removido no proximo release.
|
||||
def to_extenso
|
||||
warn('DEPRECATION WARNING: use por_extenso, pois este sera removido no proximo release.')
|
||||
self.por_extenso
|
||||
end
|
||||
|
||||
# Escreve o numero por extenso.
|
||||
#
|
||||
# Exemplo:
|
||||
# Extenso.por_extenso(1) ==> "um"
|
||||
# Extenso.por_extenso(100) ==> "cem"
|
||||
# Extenso.por_extenso(158) ==> "cento e cinquenta e oito"
|
||||
def Extenso.por_extenso(numero)
|
||||
n=numero.to_i.abs
|
||||
return case n
|
||||
when 0..9: @@unidade[n].to_s
|
||||
when 10..19: @@dezena[n].to_s
|
||||
when 20..99:
|
||||
v=n % 10
|
||||
if v== 0
|
||||
@@dezena[n].to_s
|
||||
else
|
||||
"#{@@dezena[n-v]} e #{por_extenso(v)}"
|
||||
end
|
||||
when 100
|
||||
"cem"
|
||||
when 101..999
|
||||
v=n % 100
|
||||
if v== 0
|
||||
@@centena[n].to_s
|
||||
else
|
||||
"#{@@centena[n-v]} e #{por_extenso(v)}"
|
||||
end
|
||||
when 1000..999999
|
||||
m,c=n/1000,n%1000
|
||||
%(#{por_extenso(m)} mil#{c > 0 ? " e #{por_extenso(c)}":''})
|
||||
when 1_000_000..999_999_999
|
||||
mi,m=n/1_000_000,n%1_000_000
|
||||
%(#{por_extenso(mi)} milh#{mi > 1 ? 'ões':'ão'}#{m > 0 ? " e #{por_extenso(m)}" : ''})
|
||||
when 1_000_000_000..999_999_999_999
|
||||
bi,mi=n/1_000_000_000,n%1_000_000_000
|
||||
%(#{por_extenso(bi)} bilh#{bi > 1 ? 'ões':'ão'}#{mi > 0 ? " e #{por_extenso(mi)}" : ''})
|
||||
when 1_000_000_000_000..999_999_999_999_999
|
||||
tri,bi=n/1_000_000_000_000,n%1_000_000_000_000
|
||||
%(#{por_extenso(tri)} trilh#{tri > 1 ? 'ões':'ão'}#{bi > 0 ? " e #{por_extenso(bi)}" : ''})
|
||||
else
|
||||
raise "Valor excede o permitido: #{n}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ExtensoReal
|
||||
include Extenso
|
||||
|
||||
# Escreve por extenso em reais.
|
||||
#
|
||||
# Exemplo:
|
||||
# 1.por_extenso_em_reais ==> 'um real'
|
||||
# (100.58).por_extenso_em_reais ==> 'cem reais e cinquenta e oito centavos'
|
||||
def por_extenso_em_reais
|
||||
ExtensoReal.por_extenso_em_reais(self.to_s)
|
||||
end
|
||||
|
||||
# DEPRECATION WARNING: use por_extenso_em_reais, pois este sera removido no proximo release.
|
||||
def to_extenso_real
|
||||
warn('DEPRECATION WARNING: use por_extenso_em_reais, pois este sera removido no proximo release.')
|
||||
self.por_extenso_em_reais
|
||||
end
|
||||
|
||||
# Escreve o numero por extenso em reais.
|
||||
#
|
||||
# Exemplo:
|
||||
# Extenso.por_extenso_em_reais(1) ==> "um real"
|
||||
# Extenso.por_extenso_em_reais(100) ==> "cem reais"
|
||||
# Extenso.por_extenso_em_reais(100.58) ==> "cem reais e cinquenta e oito centavos"
|
||||
def ExtensoReal.por_extenso_em_reais(valor)
|
||||
return 'grátis' if valor == 0
|
||||
case valor
|
||||
when Integer
|
||||
extenso = Extenso.por_extenso(valor)
|
||||
if extenso =~ /^(.*)(ão$|ões$)/
|
||||
complemento = 'de '
|
||||
else
|
||||
complemento = ''
|
||||
end
|
||||
%(#{extenso} #{valor <= 1 ? 'real': "#{complemento}reais"})
|
||||
when Float
|
||||
real,cents=("%.2f" % valor).split(/\./).map{ |m| m.to_i}
|
||||
valor_cents=Extenso.por_extenso(cents%100)
|
||||
|
||||
valor_cents+= case cents.to_i%100
|
||||
when 0: ""
|
||||
when 1: " centavo"
|
||||
when 2..99: " centavos"
|
||||
end
|
||||
|
||||
if real.to_i > 0
|
||||
"#{ExtensoReal.por_extenso_em_reais(real.to_i)}#{cents > 0 ? ' e ' + valor_cents : ''}"
|
||||
else
|
||||
"#{valor_cents}"
|
||||
end
|
||||
else
|
||||
ExtensoReal.por_extenso_em_reais(valor.to_s.strip.gsub(/[^\d]/,'.').to_f)
|
||||
end
|
||||
end
|
||||
end
|
@ -1,46 +0,0 @@
|
||||
module StringPortuguese
|
||||
MINUSCULAS_COM_ACENTO = 'áéíóúâêîôûàèìòùäëïöüãõñç'
|
||||
MAIUSCULAS_COM_ACENTO = 'ÁÉÍÓÚÂÊÎÔÛÀÈÌÒÙÄËÏÖÜÃÕÑÇ'
|
||||
|
||||
# Normaliza nomes proprios
|
||||
#
|
||||
# Exemplo:
|
||||
# 'maria de souza dos santos e silva da costa'.nome_proprio ==> 'Maria de Souza dos Santos e Silva da Costa'
|
||||
def nome_proprio
|
||||
palavras = []
|
||||
self.titleize().each do |palavra|
|
||||
palavra =~ /^(.)(.*)$/
|
||||
palavras << "#{$1.upcase_br}#{$2}"
|
||||
end
|
||||
palavras.join(' ').gsub(/ D(a|e|o|as|os) /, ' d\1 ').gsub(/ E /, ' e ')
|
||||
end
|
||||
|
||||
# Remove as letras acentuadas
|
||||
#
|
||||
# Exemplo:
|
||||
# 'texto está com acentuação'.remover_acentos ==> 'texto esta com acentuacao'
|
||||
def remover_acentos
|
||||
texto = self
|
||||
texto = texto.gsub(/[á|à|ã|â|ä]/, 'a').gsub(/(é|è|ê|ë)/, 'e').gsub(/(í|ì|î|ï)/, 'i').gsub(/(ó|ò|õ|ô|ö)/, 'o').gsub(/(ú|ù|û|ü)/, 'u')
|
||||
texto = texto.gsub(/(Á|À|Ã|Â|Ä)/, 'A').gsub(/(É|È|Ê|Ë)/, 'E').gsub(/(Í|Ì|Î|Ï)/, 'I').gsub(/(Ó|Ò|Õ|Ô|Ö)/, 'O').gsub(/(Ú|Ù|Û|Ü)/, 'U')
|
||||
texto = texto.gsub(/ñ/, 'n').gsub(/Ñ/, 'N')
|
||||
texto = texto.gsub(/ç/, 'c').gsub(/Ç/, 'C')
|
||||
texto
|
||||
end
|
||||
|
||||
# Retorna uma string com caracteres maiusculos
|
||||
#
|
||||
# Exemplo:
|
||||
# 'texto com acentuação'.upcase_br ==> 'TEXTO COM ACENTUAÇÃO'
|
||||
def upcase_br
|
||||
self.tr(MINUSCULAS_COM_ACENTO, MAIUSCULAS_COM_ACENTO).upcase
|
||||
end
|
||||
|
||||
# Retorna uma string com caracteres minúsculos
|
||||
#
|
||||
# Exemplo:
|
||||
# 'TEXTO COM ACENTUAÇÃO'.downcase_br ==> 'texto com acentuação'
|
||||
def downcase_br
|
||||
self.tr(MAIUSCULAS_COM_ACENTO, MINUSCULAS_COM_ACENTO).downcase
|
||||
end
|
||||
end
|
@ -1,10 +0,0 @@
|
||||
class Time
|
||||
# Retorna a hora no padrao brasileiro
|
||||
#
|
||||
# Exemplo:
|
||||
# hora = Time.new
|
||||
# hora.to_s_br ==> "27/09/2007 13:54"
|
||||
def to_s_br
|
||||
self.strftime("%d/%m/%Y %H:%M")
|
||||
end
|
||||
end
|
@ -1,12 +0,0 @@
|
||||
class CreateLancamentos < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :lancamentos do |t|
|
||||
t.column :descricao, :string, :null => false
|
||||
t.column :valor, :decimal, :precision => 14, :scale => 2, :null => false
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :lancamentos
|
||||
end
|
||||
end
|
@ -1,6 +0,0 @@
|
||||
* Como utilizar a classe Dinheiro em uma classe de modelo da aplicação?
|
||||
|
||||
Vamos imaginar um exemplo. Suponha uma classe Lancamento que possui dois atributos: descricao e valor.
|
||||
|
||||
Veja a migration utilizada no arquivo: 001_create_lancamentos.rb
|
||||
Veja a classe de modelo Lancamento no arquivo: lancamento.rb
|
@ -1,5 +0,0 @@
|
||||
class Lancamento < ActiveRecord::Base
|
||||
composed_of :valor,
|
||||
:class_name => Dinheiro,
|
||||
:mapping => [[:valor, :valor_decimal]];
|
||||
end
|
@ -1,34 +0,0 @@
|
||||
# desc "Explaining what the task does"
|
||||
# task :portugues do
|
||||
# # Task goes here
|
||||
# end
|
||||
|
||||
desc "Generate documation for Brazilian Rails plugins"
|
||||
namespace :gerar_doc do
|
||||
namespace :plugins do
|
||||
plugin = 'brazilian-rails'
|
||||
doc_base = "doc/plugins/#{plugin}"
|
||||
task(plugin => :environment) do
|
||||
FileUtils.remove_dir(doc_base, true)
|
||||
plugin_base = "vendor/plugins/#{plugin}"
|
||||
options = []
|
||||
files = Rake::FileList.new
|
||||
options << "-o doc/plugins/#{plugin}"
|
||||
options << "--title '#{plugin.titlecase} Plugin Documentation'"
|
||||
options << '--line-numbers' << '--inline-source'
|
||||
options << '-T html'
|
||||
options << '--charset UTF8'
|
||||
|
||||
files.include("#{plugin_base}/lib/**/*.rb")
|
||||
if File.exists?("#{plugin_base}/README")
|
||||
files.include("#{plugin_base}/README")
|
||||
options << "--main '#{plugin_base}/README'"
|
||||
end
|
||||
files.include("#{plugin_base}/CHANGELOG") if File.exists?("#{plugin_base}/CHANGELOG")
|
||||
|
||||
options << files.to_s
|
||||
|
||||
sh %(rdoc #{options * ' '})
|
||||
end
|
||||
end
|
||||
end
|
@ -1,161 +0,0 @@
|
||||
require File.dirname(__FILE__) + '/test_helper'
|
||||
require 'mocha'
|
||||
|
||||
class ActionViewTest < Test::Unit::TestCase
|
||||
|
||||
include ActionView::Helpers::FormHelper
|
||||
include ActionView::Helpers::ActiveRecordHelper
|
||||
include ActionView::Helpers::TextHelper
|
||||
include ActionView::Helpers::TagHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
include ActionView::Helpers::FormTagHelper
|
||||
include ActionView::Helpers::DateHelper
|
||||
|
||||
silence_warnings do
|
||||
Post = Struct.new("Post", :title, :author_name, :body, :secret, :written_on)
|
||||
Post.class_eval do
|
||||
alias_method :title_before_type_cast, :title unless respond_to?(:title_before_type_cast)
|
||||
alias_method :body_before_type_cast, :body unless respond_to?(:body_before_type_cast)
|
||||
alias_method :author_name_before_type_cast, :author_name unless respond_to?(:author_name_before_type_cast)
|
||||
end
|
||||
|
||||
User = Struct.new("User", :email)
|
||||
User.class_eval do
|
||||
alias_method :email_before_type_cast, :email unless respond_to?(:email_before_type_cast)
|
||||
end
|
||||
|
||||
Column = Struct.new("Column", :type, :name, :human_name)
|
||||
end
|
||||
|
||||
|
||||
def setup_post
|
||||
@post = Post.new
|
||||
def @post.errors
|
||||
Class.new {
|
||||
def on(field) field == "author_name" || field == "body" end
|
||||
def empty?() false end
|
||||
def count() 1 end
|
||||
def full_messages() [ "Author name can't be empty" ] end
|
||||
}.new
|
||||
end
|
||||
|
||||
def @post.new_record?() true end
|
||||
def @post.to_param() nil end
|
||||
|
||||
def @post.column_for_attribute(attr_name)
|
||||
Post.content_columns.select { |column| column.name == attr_name }.first
|
||||
end
|
||||
|
||||
silence_warnings do
|
||||
def Post.content_columns() [ Column.new(:string, "title", "Title"), Column.new(:text, "body", "Body") ] end
|
||||
end
|
||||
|
||||
@post.title = "Hello World"
|
||||
@post.author_name = ""
|
||||
@post.body = "Back to the hill and over it again!"
|
||||
@post.secret = 1
|
||||
@post.written_on = Date.new(2004, 6, 15)
|
||||
end
|
||||
|
||||
def setup_user
|
||||
@user = User.new
|
||||
def @user.errors
|
||||
Class.new {
|
||||
def on(field) field == "email" end
|
||||
def empty?() false end
|
||||
def count() 1 end
|
||||
def full_messages() [ "User email can't be empty" ] end
|
||||
}.new
|
||||
end
|
||||
|
||||
def @user.new_record?() true end
|
||||
def @user.to_param() nil end
|
||||
|
||||
def @user.column_for_attribute(attr_name)
|
||||
User.content_columns.select { |column| column.name == attr_name }.first
|
||||
end
|
||||
|
||||
silence_warnings do
|
||||
def User.content_columns() [ Column.new(:string, "email", "Email") ] end
|
||||
end
|
||||
|
||||
@user.email = ""
|
||||
end
|
||||
|
||||
def setup
|
||||
setup_post
|
||||
setup_user
|
||||
|
||||
@controller = Object.new
|
||||
def @controller.url_for(options)
|
||||
options = options.symbolize_keys
|
||||
|
||||
[options[:action], options[:id].to_param].compact.join('/')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_error_for_block
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>1 erro para post</h2><p>Foram detectados os seguintes erros:</p><ul><li>Author name can't be empty</li></ul></div>), error_messages_for("post")
|
||||
assert_equal %(<div class=\"errorDeathByClass\" id=\"errorDeathById\"><h1>1 erro para post</h1><p>Foram detectados os seguintes erros:</p><ul><li>Author name can't be empty</li></ul></div>), error_messages_for("post", :class => "errorDeathByClass", :id => "errorDeathById", :header_tag => "h1")
|
||||
assert_equal %(<div id=\"errorDeathById\"><h1>1 erro para post</h1><p>Foram detectados os seguintes erros:</p><ul><li>Author name can't be empty</li></ul></div>), error_messages_for("post", :class => nil, :id => "errorDeathById", :header_tag => "h1")
|
||||
assert_equal %(<div class=\"errorDeathByClass\"><h1>1 erro para post</h1><p>Foram detectados os seguintes erros:</p><ul><li>Author name can't be empty</li></ul></div>), error_messages_for("post", :class => "errorDeathByClass", :id => nil, :header_tag => "h1")
|
||||
end
|
||||
|
||||
def test_error_messages_for_handles_nil
|
||||
assert_equal "", error_messages_for("notthere")
|
||||
end
|
||||
|
||||
def test_error_message_on_handles_nil
|
||||
assert_equal "", error_message_on("notthere", "notthere")
|
||||
end
|
||||
|
||||
def test_error_message_on
|
||||
assert error_message_on(:post, :author_name)
|
||||
end
|
||||
|
||||
def test_error_messages_for_many_objects
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>2 erros para post</h2><p>Foram detectados os seguintes erros:</p><ul><li>Author name can't be empty</li><li>User email can't be empty</li></ul></div>), error_messages_for("post", "user")
|
||||
|
||||
# reverse the order, error order changes and so does the title
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>2 erros para user</h2><p>Foram detectados os seguintes erros:</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>), error_messages_for("user", "post")
|
||||
|
||||
# add the default to put post back in the title
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>2 erros para post</h2><p>Foram detectados os seguintes erros:</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>), error_messages_for("user", "post", :object_name => "post")
|
||||
|
||||
# symbols work as well
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>2 erros para post</h2><p>Foram detectados os seguintes erros:</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>), error_messages_for(:user, :post, :object_name => :post)
|
||||
|
||||
# any default works too
|
||||
assert_dom_equal %(<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>2 erros para monkey</h2><p>Foram detectados os seguintes erros:</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>), error_messages_for(:user, :post, :object_name => "monkey")
|
||||
end
|
||||
|
||||
def test_form_with_string_multipart
|
||||
assert_dom_equal(
|
||||
%(<form action="create" enctype="multipart/form-data" method="post"><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Create" /></form>),
|
||||
form("post", :multipart => true)
|
||||
)
|
||||
end
|
||||
|
||||
def test_distance_of_time_in_words
|
||||
assert_equal "menos de um minuto", distance_of_time_in_words("Sat Sep 08 22:51:58 -0300 2007".to_time, "Sat Sep 08 22:51:59 -0300 2007".to_time)
|
||||
assert_equal "menos de 5 segundos", distance_of_time_in_words("Sat Sep 08 22:51:58 -0300 2007".to_time, "Sat Sep 08 22:51:59 -0300 2007".to_time, true)
|
||||
assert_equal "menos de 10 segundos", distance_of_time_in_words("Sat Sep 08 22:51:50 -0300 2007".to_time, "Sat Sep 08 22:51:55 -0300 2007".to_time, true)
|
||||
assert_equal "menos de 20 segundos", distance_of_time_in_words("Sat Sep 08 22:51:00 -0300 2007".to_time, "Sat Sep 08 22:51:10 -0300 2007".to_time, true)
|
||||
assert_equal "meio minuto", distance_of_time_in_words("Sat Sep 08 22:51:00 -0300 2007".to_time, "Sat Sep 08 22:51:20 -0300 2007".to_time, true)
|
||||
assert_equal "menos de um minuto", distance_of_time_in_words("Sat Sep 08 22:51:00 -0300 2007".to_time, "Sat Sep 08 22:51:40 -0300 2007".to_time, true)
|
||||
assert_equal "1 minuto", distance_of_time_in_words("Sat Sep 08 22:51:00 -0300 2007".to_time, "Sat Sep 08 22:52:00 -0300 2007".to_time, true)
|
||||
assert_equal "1 minuto", distance_of_time_in_words("Sat Sep 08 22:51:59 -0300 2007".to_time, "Sat Sep 08 22:52:59 -0300 2007".to_time)
|
||||
assert_equal "2 minutos", distance_of_time_in_words("Sat Sep 08 22:51:59 -0300 2007".to_time, "Sat Sep 08 22:53:59 -0300 2007".to_time)
|
||||
assert_equal "aproximadamente 1 hora", distance_of_time_in_words("Sat Sep 08 21:51:59 -0300 2007".to_time, "Sat Sep 08 22:51:59 -0300 2007".to_time)
|
||||
assert_equal "aproximadamente 2 horas", distance_of_time_in_words("Sat Sep 08 20:51:59 -0300 2007".to_time, "Sat Sep 08 22:51:59 -0300 2007".to_time)
|
||||
assert_equal "1 dia", distance_of_time_in_words("Sat Sep 07 20:51:59 -0300 2007".to_time, "Sat Sep 08 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "2 dias", distance_of_time_in_words("Sat Sep 06 20:51:59 -0300 2007".to_time, "Sat Sep 08 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "aproximadamente 1 mês", distance_of_time_in_words("Sat Oct 06 20:51:59 -0300 2007".to_time, "Sat Sep 06 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "2 meses", distance_of_time_in_words("Sat Nov 06 20:51:59 -0300 2007".to_time, "Sat Sep 06 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "12 meses", distance_of_time_in_words("Sat Nov 06 20:51:59 -0300 2006".to_time, "Sat Nov 06 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "aproximadamente 1 ano", distance_of_time_in_words("Sat Nov 06 20:51:59 -0300 2006".to_time, "Sat Dec 06 20:51:59 -0300 2007".to_time)
|
||||
assert_equal "mais de 3 anos", distance_of_time_in_words("Sat Nov 06 20:51:59 -0300 2006".to_time, "Sat Dec 06 20:51:59 -0300 2009".to_time)
|
||||
end
|
||||
|
||||
end
|
@ -1,30 +0,0 @@
|
||||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class ActiveRecordTestable < ActiveRecord::Errors
|
||||
|
||||
def self.default_error_messages
|
||||
@@default_error_messages
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ActiveRecordTest < Test::Unit::TestCase
|
||||
|
||||
# Replace this with your real tests.
|
||||
def test_this_plugin
|
||||
errors = ActiveRecordTestable.default_error_messages
|
||||
assert_equal "não está incluído na lista", errors[:inclusion]
|
||||
assert_equal "está reservado", errors[:exclusion]
|
||||
assert_equal "é inválido.", errors[:invalid]
|
||||
assert_equal "não corresponde à confirmação", errors[:confirmation]
|
||||
assert_equal "deve ser aceito", errors[:accepted]
|
||||
assert_equal "não pode estar vazio", errors[:empty]
|
||||
assert_equal "não pode estar em branco", errors[:blank]
|
||||
assert_equal "muito longo (máximo %d caracteres)", errors[:too_long]
|
||||
assert_equal "muito curto (mínimo %d caracteres)", errors[:too_short]
|
||||
assert_equal "de comprimento errado (deveria ter %d caracteres)", errors[:wrong_length]
|
||||
assert_equal "já está em uso", errors[:taken]
|
||||
assert_equal "não é um número", errors[:not_a_number]
|
||||
end
|
||||
|
||||
end
|
@ -1,95 +0,0 @@
|
||||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class DateTest < Test::Unit::TestCase
|
||||
|
||||
# to_date
|
||||
def test_create_date_with_traditional_date_format
|
||||
assert_equal "2007-01-02", "2007/01/02".to_date.to_s
|
||||
end
|
||||
|
||||
def test_create_date_with_brazilian_date_format
|
||||
assert_equal "2007-12-13", "13/12/2007".to_date.to_s
|
||||
end
|
||||
|
||||
def test_create_date_with_other_brazilian_date_format
|
||||
assert_equal "2007-02-01", "01-02-2007".to_date.to_s
|
||||
end
|
||||
|
||||
|
||||
#to_s
|
||||
def test_date_to_s_with_traditional_format
|
||||
assert_equal "2007-02-01", "01/02/2007".to_date.to_s
|
||||
end
|
||||
|
||||
#to_s_br
|
||||
def test_date_to_s_br
|
||||
assert_equal "13/12/2007", "13/12/2007".to_date.to_s_br
|
||||
end
|
||||
|
||||
#valid?
|
||||
def test_valid_when_date_format_is_traditional_and_valid_format_and_valid_civil
|
||||
assert Date.valid?("2007/01/02"), "Should be a valid date"
|
||||
end
|
||||
|
||||
def test_valid_when_date_format_is_brazilian_and_valid_format_and_valid_civil
|
||||
assert Date.valid?("13/12/2007"), "Should be a valid date"
|
||||
end
|
||||
|
||||
def test_valid_when_date_format_is_invalid
|
||||
assert !Date.valid?("13/12/200A"), "Should be a invalid date"
|
||||
end
|
||||
|
||||
def test_valid_when_date_format_is_brazilian_and_valid_format_and_invalid_civil
|
||||
assert !Date.valid?("00/00/0000"), "Should be a invalid date"
|
||||
end
|
||||
|
||||
def test_month_names
|
||||
assert_equal [nil,
|
||||
"Janeiro",
|
||||
"Fevereiro",
|
||||
"Marco",
|
||||
"Abril",
|
||||
"Maio",
|
||||
"Junho",
|
||||
"Julho",
|
||||
"Agosto",
|
||||
"Setembro",
|
||||
"Outubro",
|
||||
"Novembro",
|
||||
"Dezembro"],
|
||||
Date::MONTHNAMES
|
||||
end
|
||||
|
||||
def test_days_names
|
||||
assert_equal ["Domingo",
|
||||
"Segunda-Feira",
|
||||
"Terca-Feira",
|
||||
"Quarta-Feira",
|
||||
"Quinta-Feira",
|
||||
"Sexta-Feira",
|
||||
"Sabado"],
|
||||
Date::DAYNAMES
|
||||
end
|
||||
|
||||
def test_abbr_monthnames
|
||||
assert_equal [nil,
|
||||
"Jan",
|
||||
"Fev",
|
||||
"Mar",
|
||||
"Abr",
|
||||
"Mai",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Ago",
|
||||
"Set",
|
||||
"Out",
|
||||
"Nov",
|
||||
"Dez"],
|
||||
Date::ABBR_MONTHNAMES
|
||||
end
|
||||
|
||||
def test_abbr_daysnames
|
||||
assert_equal ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"], Date::ABBR_DAYNAMES
|
||||
end
|
||||
|
||||
end
|
@ -1,435 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
||||
|
||||
class DinheiroTest < Test::Unit::TestCase
|
||||
|
||||
CONTABIL = { "(2,00)" => -2,
|
||||
"2,00" => 2,
|
||||
"0,00" => 0,
|
||||
"0,32" => 0.32,
|
||||
"(0,01)" => -0.01 }
|
||||
|
||||
REAL_CONTABIL = { "R$ (1,00)" => -1,
|
||||
"R$ (0,12)" => -0.12,
|
||||
"R$ 1,00" => 1,
|
||||
"R$ 1,00" => 1,
|
||||
"R$ 1,00" => 1,
|
||||
"R$ 0,00" => 0 }
|
||||
|
||||
SOMA = { 0.real => 0.real + 0.real,
|
||||
1.real => 0.real + 1.real,
|
||||
1.real => 1.real + 0.real,
|
||||
2.reais => 1.real + 1.real,
|
||||
2.reais => 0.real + 2.reais,
|
||||
2.reais => 2.reais + 0.real,
|
||||
0.real => 2.real + -2.real,
|
||||
0.real => 0.real + BigDecimal.new("0"),
|
||||
0.3.real => 0.real + 0.3.real,
|
||||
-0.3.real => 0.real + -0.3.real,
|
||||
-0.03.real => 0 + -0.03.real,
|
||||
-0.03.real => 0.real + -0.03,
|
||||
-1.03.real => -1.real + -0.03,
|
||||
-1.03.real => -1.real + BigDecimal.new("-0.03") }
|
||||
|
||||
SUBTRACAO = { 0.real => 0.real - 0.real,
|
||||
-1.real => 0.real - 1.real,
|
||||
1.real => 1.real - 0.real,
|
||||
0.real => 1.real - 1.real,
|
||||
-2.reais => 0.real - 2.reais,
|
||||
2.reais => 2.reais - 0.real,
|
||||
-4.reais => -2.reais - 2.reais,
|
||||
0.3.real => 0.3.real - 0.real,
|
||||
0.03.real => 0.03.real - 0.real,
|
||||
0.03.real => 0.06.real - 0.03.real,
|
||||
-0.03.real => 0 - 0.03.real,
|
||||
-0.03.real => 0.real - 0.03,
|
||||
-1.03.real => -1.real - 0.03,
|
||||
-1.03.real => -1.real - BigDecimal.new("0.03") }
|
||||
|
||||
MULTIPLICACAO = { 0.real => 0.real * 0,
|
||||
0.real => 0.real * 1,
|
||||
0.real => 0.real * -1,
|
||||
1.real => 1.real * 1,
|
||||
1.real => -1.real * -1,
|
||||
-1.real => 1.real * -1,
|
||||
-1.real => -1.real * 1,
|
||||
0.1.real => 1.real * 0.1,
|
||||
0.01.real => 1.real * 0.01,
|
||||
0.01.real => 1.real * 0.009,
|
||||
0.01.real => 1.real * 0.005,
|
||||
0.00.real => 1.real * 0.0049,
|
||||
0.1.real => 0.1.real * 1,
|
||||
0.01.real => 0.01.real * 1,
|
||||
0.01.real => 0.009.real * 1,
|
||||
0.00.real => 0.00049.real * 1,
|
||||
0.real => 0.real * 0.real,
|
||||
0.real => 0.real * BigDecimal("0"),
|
||||
1.real => 1.real * 1.real,
|
||||
1.real => 1.real * BigDecimal("1"),
|
||||
1.real => 0.5.real * 2.real,
|
||||
1.real => 0.5.real * BigDecimal("2"),
|
||||
1.real => 1 * 1.real,
|
||||
-1.real => -1 * 1.real,
|
||||
1.real => -1 * -1.real,
|
||||
0.01.real => 0.01 * 1.real,
|
||||
0.01.real => 1.real * BigDecimal("0.01"),
|
||||
0.01.real => BigDecimal("0.01") * 1.real }
|
||||
|
||||
DIVISAO = {
|
||||
[Dinheiro.new(0.33), Dinheiro.new(0.33), Dinheiro.new(0.34)] => Dinheiro.new(1) / 3,
|
||||
[Dinheiro.new(33.33), Dinheiro.new(33.33), Dinheiro.new(33.34)] => Dinheiro.new(100) / 3,
|
||||
[Dinheiro.new(50.00), Dinheiro.new(50)] => Dinheiro.new(100) / 2,
|
||||
[Dinheiro.new(0.25), Dinheiro.new(0.25)] => Dinheiro.new(0.5) / 2,
|
||||
[Dinheiro.new(0.16), Dinheiro.new(0.16),Dinheiro.new(0.18)] => Dinheiro.new(0.5) / 3,
|
||||
[Dinheiro.new(0.33)] => Dinheiro.new(0.33) / 1 ,
|
||||
[Dinheiro.new(0.33)] => Dinheiro.new(0.33) / 1 ,
|
||||
}
|
||||
|
||||
|
||||
QUANTIA_COM_FORMATO_VALIDO = [ "1211",
|
||||
"1211.",
|
||||
"1211.0",
|
||||
"1211.23",
|
||||
"1211,23",
|
||||
"1.211",
|
||||
"1.211,00",
|
||||
"1.211,01",
|
||||
"1.211,1",
|
||||
"1.211,",
|
||||
"1,",
|
||||
"12,",
|
||||
"32349898989912,",
|
||||
"32.349.898.989.912,",
|
||||
"32.349.898.989.912,1",
|
||||
"32.349.898.989.912,12",
|
||||
"1",
|
||||
"1.00",
|
||||
"1.01",
|
||||
"1.1",
|
||||
"1.",
|
||||
".1",
|
||||
".12",
|
||||
"0.12",
|
||||
"1.12",
|
||||
"12.12",
|
||||
"12.12",
|
||||
"123.12",
|
||||
"1,234.12",
|
||||
"12,234.12",
|
||||
"123,234.12",
|
||||
"2,123,234.12",
|
||||
",1",
|
||||
",11",
|
||||
",01",
|
||||
"0,01" ]
|
||||
QUANTIA_COM_FORMATO_INVALIDO = [ 'teste',
|
||||
'12,123,99',
|
||||
'12.123.99',
|
||||
'1,123,99',
|
||||
'1212,39.90' ]
|
||||
|
||||
COMPARACAO = [ 1.real < 2.reais,
|
||||
1.real <= 2.reais,
|
||||
2.real > 1.real,
|
||||
2.real >= 1.real,
|
||||
1.real == 1.real,
|
||||
1.real >= 1.real,
|
||||
1.real <= 1.real ]
|
||||
|
||||
COMPARACAO_COM_ESCALAR = [ 1.real < 2.00,
|
||||
1.real <= 2.00,
|
||||
2.real > 1.00,
|
||||
2.real >= 1.00,
|
||||
1.real == 1.00,
|
||||
1.real >= 1.00,
|
||||
1.real <= 1.00 ]
|
||||
|
||||
ARREDONDAMENTO = { 23049 => 230.49,
|
||||
23049 => 230.4949999999,
|
||||
23050 => 230.495 }
|
||||
|
||||
PONTO_NO_MILHAR = { "234.175.211" => "234175211",
|
||||
"" => "",
|
||||
"1" => "1",
|
||||
"12" => "12",
|
||||
"123" => "123",
|
||||
"1.234" => "1234",
|
||||
"12.345" => "12345",
|
||||
"123.456" => "123456",
|
||||
"123.112.211" => "123112211",
|
||||
"1.234.567" => "1234567" }
|
||||
|
||||
QUANTIA_VALIDA = { "0,00" => 0 ,
|
||||
"0,00" => 0.0 ,
|
||||
"0,00" => "0" ,
|
||||
"0,00" => "0,00" ,
|
||||
"1,00" => 1 ,
|
||||
"1,03" => 1.03 ,
|
||||
"1,03" => "1,03" ,
|
||||
"0,03" => ",03" ,
|
||||
"0,30" => ",3" ,
|
||||
"0,03" => ".03" ,
|
||||
"0,30" => ".3" ,
|
||||
"-0,30" => -0.3 ,
|
||||
"-0,03" => -0.03 ,
|
||||
"1,00" => "1,00" ,
|
||||
"-1,00" => -1 ,
|
||||
"-1,00" => -1.0 ,
|
||||
"-1,00" => "-1" ,
|
||||
"-1,00" => "-1,00" ,
|
||||
"-2,30" => "-2,30" ,
|
||||
"2,30" => "2,30" ,
|
||||
"2,30" => 2.30 ,
|
||||
"2,30" => 2.3 ,
|
||||
"1.211,00" => "1211,00" ,
|
||||
"1.211,01" => "1211,01" ,
|
||||
"1.211,50" => "1211,5" ,
|
||||
"1.211,00" => "1211," ,
|
||||
"1.211,00" => "1211" ,
|
||||
"1.211,00" => "1211.00" ,
|
||||
"1.211,01" => "1211.01" ,
|
||||
"1.211,20" => "1211.2" ,
|
||||
"1.211,00" => "1211." ,
|
||||
"1.211,00" => "1211" ,
|
||||
"1.211,00" => "1.211" ,
|
||||
"123.112.211,35" => "123112211,35" ,
|
||||
"-123.112.211,35" => "-123112211,35" ,
|
||||
"123.112.211,35" => "+123112211,35" }
|
||||
|
||||
PARTE_INTEIRA = [ -1, -123112211, 0, 1, 12344545 ]
|
||||
|
||||
|
||||
def setup
|
||||
tornar_metodos_publicos Dinheiro
|
||||
@dinheiro = 1.real
|
||||
end
|
||||
|
||||
def testa_se_cria_dinheiro_a_partir_de_quantias_validos
|
||||
QUANTIA_VALIDA.each do |esperado, quantia|
|
||||
assert_equal esperado, Dinheiro.new(quantia).to_s, "Deveria ter vindo o quantia: #{esperado} quando recebeu #{quantia}"
|
||||
end
|
||||
end
|
||||
|
||||
# coloca_ponto_no_milhar
|
||||
def testa_se_coloca_ponto_no_milhar
|
||||
PONTO_NO_MILHAR.each do |esperado, quantia|
|
||||
{ esperado => quantia,
|
||||
"-#{esperado}" => "-#{quantia}" }.each do |esperado, quantia|
|
||||
assert_equal esperado, @dinheiro.inteiro_com_milhar(quantia)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# real
|
||||
def testa_real
|
||||
assert_equal "R$ 1,00", Dinheiro.new(1).real
|
||||
end
|
||||
|
||||
def testa_real_contabil
|
||||
REAL_CONTABIL.each { |esperado, quantia| assert_equal esperado, Dinheiro.new(quantia).real_contabil }
|
||||
end
|
||||
|
||||
def testa_reais_contabeis
|
||||
REAL_CONTABIL.each { |esperado, quantia| assert_equal esperado, Dinheiro.new(quantia).reais_contabeis }
|
||||
end
|
||||
|
||||
# reais
|
||||
def testa_reais
|
||||
assert_equal "R$ 2,00", Dinheiro.new(2).reais
|
||||
end
|
||||
|
||||
def testa_contabil
|
||||
CONTABIL.each { |esperado, quantia| assert_equal esperado, Dinheiro.new(quantia).contabil }
|
||||
end
|
||||
|
||||
# ==
|
||||
def testa_igualdade
|
||||
assert_equal Dinheiro.new(1), Dinheiro.new(1)
|
||||
end
|
||||
|
||||
def testa_igualdade_quando_passa_possivel_dinheiro
|
||||
assert_equal Dinheiro.new(1), 1.0
|
||||
end
|
||||
|
||||
# / (divisao/parcelamento)
|
||||
def testa_divisao
|
||||
DIVISAO.each { |parcelas, divisao| assert_equal parcelas, divisao }
|
||||
end
|
||||
|
||||
def testa_divisao_por_zero
|
||||
assert_raise(ZeroDivisionError) { 1.real / 0 }
|
||||
end
|
||||
|
||||
def testa_divisao_por_algo_que_nao_seja_um_escalar
|
||||
assert_raise(DivisaPorNaoEscalarError) { 10.reais / 2.reais }
|
||||
end
|
||||
|
||||
# initialize
|
||||
def testa_se_cria_dinheiro_a_partir_de_float
|
||||
verifica_se_cria_dinheiro_para 1.0
|
||||
end
|
||||
|
||||
def testa_se_cria_dinheiro_a_partir_de_fixnum
|
||||
verifica_se_cria_dinheiro_para 1
|
||||
end
|
||||
|
||||
def testa_se_cria_dinheiro_a_partir_de_bigdecimal
|
||||
verifica_se_cria_dinheiro_para BigDecimal.new("1")
|
||||
end
|
||||
|
||||
def testa_se_cria_dinheiro_a_partir_de_string
|
||||
verifica_se_cria_dinheiro_para "1"
|
||||
end
|
||||
|
||||
def testa_se_rejeita_criacao_de_dinheiro_a_partir_de_string_invalida
|
||||
QUANTIA_COM_FORMATO_INVALIDO.each do |quantia|
|
||||
assert_raise DinheiroInvalidoError, "Deveria ter rejeitado [#{quantia}]" do
|
||||
Dinheiro.new quantia
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# + (soma)
|
||||
def testa_soma
|
||||
SOMA.each{ |esperado, soma| assert_equal esperado, soma }
|
||||
end
|
||||
|
||||
# - (subtracao)
|
||||
def testa_subtracao
|
||||
SUBTRACAO.each { |esperado, subtracao| assert_equal esperado, subtracao }
|
||||
end
|
||||
|
||||
# * (multiplicacao)
|
||||
def testa_multiplicacao
|
||||
MULTIPLICACAO.each { |esperado, multiplicacao| assert_equal esperado, multiplicacao }
|
||||
end
|
||||
|
||||
# quantia_de
|
||||
def testa_quantia_de
|
||||
assert_equal 0, @dinheiro.quantia_de(0.real)
|
||||
assert_equal 0, @dinheiro.quantia_de(0)
|
||||
end
|
||||
|
||||
#por_extenso
|
||||
def testa_por_extenso
|
||||
assert_equal 'um real', 1.real.por_extenso
|
||||
assert_equal 'um centavo', (0.01).real.por_extenso
|
||||
assert_equal 'cem reais', 100.real.por_extenso
|
||||
assert_equal 'cem reais e um centavo', (100.01).real.por_extenso
|
||||
end
|
||||
|
||||
#por_extenso_em_reais
|
||||
def testa_por_extenso
|
||||
assert_equal 'um real', 1.real.por_extenso_em_reais
|
||||
assert_equal 'um centavo', (0.01).real.por_extenso_em_reais
|
||||
assert_equal 'cem reais', 100.real.por_extenso_em_reais
|
||||
assert_equal 'cem reais e um centavo', (100.01).real.por_extenso_em_reais
|
||||
end
|
||||
|
||||
# to_f
|
||||
def testa_to_f
|
||||
assert_equal 2.30, 2.30.real.to_f
|
||||
end
|
||||
|
||||
# quantia_respeita_formato?
|
||||
def testa_se_quantia_respeita_formato
|
||||
QUANTIA_COM_FORMATO_VALIDO.each { |quantia| verifica_se_quantia_respeita_formato quantia }
|
||||
end
|
||||
|
||||
# >, <, == (ordenacao)
|
||||
def testa_comparacao_entre_dinheiro
|
||||
COMPARACAO.each { |comparacao| assert comparacao }
|
||||
end
|
||||
|
||||
def testa_comparacao_entre_possivel_dinheiro
|
||||
COMPARACAO_COM_ESCALAR.each { |comparacao_com_escalar| assert comparacao_com_escalar }
|
||||
end
|
||||
|
||||
# decimal
|
||||
def testa_decimal_quando_todas_as_casas_estao_preenchidas
|
||||
verifica_decimal("12")
|
||||
end
|
||||
|
||||
def testa_decimal_quando_apenas_uma_das_casas_esta_preenchida
|
||||
verifica_decimal("10", "1")
|
||||
end
|
||||
|
||||
def testa_decimal_quando_nenhuma_das_casas_esta_preenchida
|
||||
verifica_decimal("00", "")
|
||||
end
|
||||
|
||||
def testa_se_transforma_em_string_que_represente_a_quantia_quando_tem_tres_digitos
|
||||
verifica_se_transforma_em_string_corretamente "1.23", 123
|
||||
end
|
||||
|
||||
def testa_se_transforma_em_string_que_represente_a_quantia_quando_tem_dois_digitos
|
||||
verifica_se_transforma_em_string_corretamente "0.12", 12
|
||||
end
|
||||
|
||||
def testa_se_transforma_em_string_que_represente_a_quantia_quando_tem_um_digito
|
||||
verifica_se_transforma_em_string_corretamente "0.03", 3
|
||||
end
|
||||
|
||||
def testa_se_transforma_em_string_para_valores_especiais
|
||||
verifica_se_transforma_em_string_corretamente "-123112211.00", -12311221100
|
||||
end
|
||||
|
||||
# parte_inteira
|
||||
def testa_parte_inteira
|
||||
PARTE_INTEIRA.each { |quantia| assert_equal "#{quantia}", Dinheiro.new(quantia).parte_inteira }
|
||||
end
|
||||
|
||||
def testa_se_arredonda_valores_corretamente
|
||||
ARREDONDAMENTO.each do |esperado, quantia|
|
||||
assert_equal esperado, Dinheiro.new(quantia).quantia, "Deveria retornar #{esperado} para #{quantia}"
|
||||
end
|
||||
end
|
||||
|
||||
def testa_se_valor_decimal_cria_o_big_decimal_corretamente
|
||||
assert_equal BigDecimal.new("1234.56"), Dinheiro.new("1234,56").valor_decimal
|
||||
end
|
||||
|
||||
def testa_soma_de_dinheiro_com_big_decimal
|
||||
assert_equal Dinheiro.new(200), BigDecimal.new("100").reais + "100".reais
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def verifica_se_transforma_em_string_corretamente(quantia_esperada, quantia)
|
||||
assert_equal quantia_esperada, @dinheiro.transforma_em_string_que_represente_a_quantia(quantia)
|
||||
end
|
||||
|
||||
def verifica_decimal(esperado, quantia = esperado)
|
||||
assert_equal esperado, @dinheiro.decimal("." + quantia)
|
||||
assert_equal esperado, @dinheiro.decimal("," + quantia)
|
||||
assert_equal esperado, @dinheiro.decimal(quantia) if quantia.blank?
|
||||
end
|
||||
|
||||
def verifica_se_quantia_respeita_formato(quantia)
|
||||
formatos_validos(quantia).each do |quantia_str|
|
||||
assert 1.real.quantia_respeita_formato?(quantia_str), "O sistema deveria considerar o quantia '#{quantia_str}' dentro do formato valido."
|
||||
end
|
||||
end
|
||||
|
||||
def formatos_validos(quantia)
|
||||
formatos_validos = []
|
||||
quantias_validas(quantia).each do |quantia|
|
||||
formatos_validos << quantia
|
||||
[ "R$", "r$" ].each do |simbolo|
|
||||
[ "", " ", " " ].each do |espacos|
|
||||
formatos_validos << "#{simbolo}#{espacos}#{quantia}"
|
||||
end
|
||||
end
|
||||
end
|
||||
formatos_validos
|
||||
end
|
||||
|
||||
def quantias_validas(quantia)
|
||||
return [quantia] if [ ".", "," ].include?(quantia[0..0])
|
||||
[ quantia, "-#{quantia}" ]
|
||||
end
|
||||
|
||||
def verifica_se_cria_dinheiro_para(quantia)
|
||||
assert quantia.para_dinheiro.kind_of?(Dinheiro)
|
||||
end
|
||||
|
||||
end
|
@ -1,93 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
||||
|
||||
class InflectorTest < Test::Unit::TestCase
|
||||
|
||||
#general rule: add "s" to the end of the word
|
||||
def test_general_rule
|
||||
words = {:casa => "casas",
|
||||
:pe => "pes",
|
||||
:saci => "sacis",
|
||||
:carro => "carros",
|
||||
:pneu => "pneus"
|
||||
}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
#if word ends in "r" or "z", add "es"
|
||||
def test_when_word_ends_in_r_or_z
|
||||
words = {:flor => "flores",
|
||||
:luz => "luzes"
|
||||
}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
#if word ends in "al", "el", "ol", "ul": trade "l" with "is"
|
||||
def test_when_word_ends_in_al_el_ol_ul
|
||||
words = {:hospital => "hospitais",
|
||||
:telemovel => "telemoveis",
|
||||
:farol => "farois",
|
||||
:azul => "azuis"
|
||||
}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
|
||||
#if word ends in "il" and has tônic accent in last syllable, trade "il" with "is"
|
||||
def test_when_word_end_in_il
|
||||
words = {:cantil => "cantis"}
|
||||
verify_pluralize words
|
||||
end
|
||||
|
||||
|
||||
#if word ends in "m", trade "m" with "ns"
|
||||
def test_plurilize_when_word_ends_in_m
|
||||
words = {:armazem => "armazens"}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
#if word ends in "s" and has one silable, trade "s" with "es"
|
||||
def test_plurilize_when_word_ends_in_s
|
||||
words = {:portugues => "portugueses"}
|
||||
verify_pluralize words
|
||||
end
|
||||
|
||||
def test_when_word_ends_in_ao
|
||||
words = {:portão => "portões"}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
def test_when_irregular_singular
|
||||
words = {:cão => "cães",
|
||||
:pão => "pães",
|
||||
:mão => "mãos",
|
||||
:alemão => "alemães"
|
||||
}
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
|
||||
def test_when_uncountable
|
||||
words = {:tennis => "tennis",
|
||||
:torax => "torax"
|
||||
}
|
||||
verify_pluralize words
|
||||
verify_singularize words
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def verify_pluralize(words)
|
||||
words.each { |key,value| assert_equal value, key.to_s.pluralize}
|
||||
end
|
||||
|
||||
def verify_singularize(words)
|
||||
words.each { |key,value| assert_equal key.to_s, value.singularize}
|
||||
end
|
||||
|
||||
end
|
@ -1,184 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
||||
|
||||
class NumberTest < Test::Unit::TestCase
|
||||
def test_unidades
|
||||
assert_equal 'zero', 0.por_extenso
|
||||
assert_equal 'um', 1.por_extenso
|
||||
assert_equal 'dois', 2.por_extenso
|
||||
assert_equal 'três', 3.por_extenso
|
||||
assert_equal 'quatro', 4.por_extenso
|
||||
assert_equal 'cinco', 5.por_extenso
|
||||
assert_equal 'seis', 6.por_extenso
|
||||
assert_equal 'sete', 7.por_extenso
|
||||
assert_equal 'oito', 8.por_extenso
|
||||
assert_equal 'nove', 9.por_extenso
|
||||
end
|
||||
|
||||
def test_dezenas
|
||||
assert_equal 'dez', 10.por_extenso
|
||||
assert_equal 'onze', 11.por_extenso
|
||||
assert_equal 'doze', 12.por_extenso
|
||||
assert_equal 'treze', 13.por_extenso
|
||||
assert_equal 'quatorze', 14.por_extenso
|
||||
assert_equal 'quinze', 15.por_extenso
|
||||
assert_equal 'dezesseis', 16.por_extenso
|
||||
assert_equal 'dezessete', 17.por_extenso
|
||||
assert_equal 'dezoito', 18.por_extenso
|
||||
assert_equal 'dezenove', 19.por_extenso
|
||||
assert_equal 'vinte', 20.por_extenso
|
||||
assert_equal 'trinta', 30.por_extenso
|
||||
assert_equal 'quarenta', 40.por_extenso
|
||||
assert_equal 'cinquenta', 50.por_extenso
|
||||
assert_equal 'sessenta', 60.por_extenso
|
||||
assert_equal 'setenta', 70.por_extenso
|
||||
assert_equal 'oitenta', 80.por_extenso
|
||||
assert_equal 'noventa', 90.por_extenso
|
||||
end
|
||||
|
||||
def test_dezenas_com_unidades
|
||||
assert_equal 'vinte e um', 21.por_extenso
|
||||
assert_equal 'trinta e dois', 32.por_extenso
|
||||
assert_equal 'quarenta e três', 43.por_extenso
|
||||
assert_equal 'cinquenta e quatro', 54.por_extenso
|
||||
assert_equal 'sessenta e cinco', 65.por_extenso
|
||||
assert_equal 'setenta e seis', 76.por_extenso
|
||||
assert_equal 'oitenta e sete', 87.por_extenso
|
||||
assert_equal 'noventa e oito', 98.por_extenso
|
||||
end
|
||||
|
||||
def test_centenas
|
||||
assert_equal 'cem', 100.por_extenso
|
||||
assert_equal 'duzentos', 200.por_extenso
|
||||
assert_equal 'trezentos', 300.por_extenso
|
||||
assert_equal 'quatrocentos', 400.por_extenso
|
||||
assert_equal 'quinhentos', 500.por_extenso
|
||||
assert_equal 'seiscentos', 600.por_extenso
|
||||
assert_equal 'setecentos', 700.por_extenso
|
||||
assert_equal 'oitocentos', 800.por_extenso
|
||||
assert_equal 'novecentos', 900.por_extenso
|
||||
end
|
||||
|
||||
def test_centenas_com_dezenas_e_unidades
|
||||
assert_equal 'cento e um', 101.por_extenso
|
||||
assert_equal 'cento e dez', 110.por_extenso
|
||||
assert_equal 'cento e onze', 111.por_extenso
|
||||
|
||||
assert_equal 'duzentos e dois', 202.por_extenso
|
||||
assert_equal 'duzentos e vinte', 220.por_extenso
|
||||
assert_equal 'duzentos e vinte e dois', 222.por_extenso
|
||||
|
||||
assert_equal 'trezentos e três', 303.por_extenso
|
||||
assert_equal 'trezentos e trinta', 330.por_extenso
|
||||
assert_equal 'trezentos e trinta e três', 333.por_extenso
|
||||
|
||||
assert_equal 'quatrocentos e quatro', 404.por_extenso
|
||||
assert_equal 'quatrocentos e quarenta', 440.por_extenso
|
||||
assert_equal 'quatrocentos e quarenta e quatro', 444.por_extenso
|
||||
|
||||
assert_equal 'quinhentos e cinco', 505.por_extenso
|
||||
assert_equal 'quinhentos e cinquenta', 550.por_extenso
|
||||
assert_equal 'quinhentos e cinquenta e cinco', 555.por_extenso
|
||||
|
||||
assert_equal 'seiscentos e seis', 606.por_extenso
|
||||
assert_equal 'seiscentos e sessenta', 660.por_extenso
|
||||
assert_equal 'seiscentos e sessenta e seis', 666.por_extenso
|
||||
|
||||
assert_equal 'setecentos e sete', 707.por_extenso
|
||||
assert_equal 'setecentos e setenta', 770.por_extenso
|
||||
assert_equal 'setecentos e setenta e sete', 777.por_extenso
|
||||
|
||||
assert_equal 'oitocentos e oito', 808.por_extenso
|
||||
assert_equal 'oitocentos e oitenta', 880.por_extenso
|
||||
assert_equal 'oitocentos e oitenta e oito', 888.por_extenso
|
||||
|
||||
assert_equal 'novecentos e nove', 909.por_extenso
|
||||
assert_equal 'novecentos e noventa', 990.por_extenso
|
||||
assert_equal 'novecentos e noventa e nove', 999.por_extenso
|
||||
end
|
||||
|
||||
def test_mil
|
||||
assert_equal 'um mil', 1_000.por_extenso
|
||||
assert_equal 'um mil e um', 1_001.por_extenso
|
||||
assert_equal 'um mil e dez', 1_010.por_extenso
|
||||
assert_equal 'um mil e onze', 1_011.por_extenso
|
||||
assert_equal 'um mil e cem', 1_100.por_extenso
|
||||
assert_equal 'um mil e cento e um', 1_101.por_extenso
|
||||
assert_equal 'um mil e cento e dez', 1_110.por_extenso
|
||||
assert_equal 'um mil e cento e onze', 1_111.por_extenso
|
||||
assert_equal 'dez mil', 10_000.por_extenso
|
||||
assert_equal 'cem mil', 100_000.por_extenso
|
||||
assert_equal 'cento e dez mil', 110_000.por_extenso
|
||||
end
|
||||
|
||||
def test_milhao
|
||||
assert_equal 'um milhão', 1_000_000.por_extenso
|
||||
assert_equal 'um milhão e um mil e um', 1_001_001.por_extenso
|
||||
assert_equal 'um milhão e dez mil e dez', 1_010_010.por_extenso
|
||||
assert_equal 'um milhão e onze mil e onze', 1_011_011.por_extenso
|
||||
assert_equal 'um milhão e cem mil e cem', 1_100_100.por_extenso
|
||||
assert_equal 'um milhão e cento e um mil e cento e um', 1_101_101.por_extenso
|
||||
assert_equal 'um milhão e cento e dez mil e cento e dez', 1_110_110.por_extenso
|
||||
assert_equal 'um milhão e cento e onze mil e cento e onze', 1_111_111.por_extenso
|
||||
assert_equal 'dez milhões', 10_000_000.por_extenso
|
||||
assert_equal 'cem milhões', 100_000_000.por_extenso
|
||||
assert_equal 'cento e dez milhões', 110_000_000.por_extenso
|
||||
end
|
||||
|
||||
def test_bilhao
|
||||
assert_equal 'um bilhão', 1_000_000_000.por_extenso
|
||||
assert_equal 'um bilhão e um milhão e um mil e um', 1_001_001_001.por_extenso
|
||||
assert_equal 'um bilhão e dez milhões e dez mil e dez', 1_010_010_010.por_extenso
|
||||
assert_equal 'um bilhão e onze milhões e onze mil e onze', 1_011_011_011.por_extenso
|
||||
assert_equal 'um bilhão e cem milhões e cem mil e cem', 1_100_100_100.por_extenso
|
||||
assert_equal 'um bilhão e cento e um milhões e cento e um mil e cento e um', 1_101_101_101.por_extenso
|
||||
assert_equal 'um bilhão e cento e dez milhões e cento e dez mil e cento e dez', 1_110_110_110.por_extenso
|
||||
assert_equal 'um bilhão e cento e onze milhões e cento e onze mil e cento e onze', 1_111_111_111.por_extenso
|
||||
assert_equal 'dez bilhões', 10_000_000_000.por_extenso
|
||||
assert_equal 'cem bilhões', 100_000_000_000.por_extenso
|
||||
assert_equal 'cento e dez bilhões', 110_000_000_000.por_extenso
|
||||
end
|
||||
|
||||
def test_trilhao
|
||||
assert_equal 'um trilhão', 1_000_000_000_000.por_extenso
|
||||
assert_equal 'um trilhão e um bilhão e um milhão e um mil e um', 1_001_001_001_001.por_extenso
|
||||
assert_equal 'um trilhão e dez bilhões e dez milhões e dez mil e dez', 1_010_010_010_010.por_extenso
|
||||
assert_equal 'um trilhão e onze bilhões e onze milhões e onze mil e onze', 1_011_011_011_011.por_extenso
|
||||
assert_equal 'um trilhão e cem bilhões e cem milhões e cem mil e cem', 1_100_100_100_100.por_extenso
|
||||
assert_equal 'um trilhão e cento e um bilhões e cento e um milhões e cento e um mil e cento e um', 1_101_101_101_101.por_extenso
|
||||
assert_equal 'um trilhão e cento e dez bilhões e cento e dez milhões e cento e dez mil e cento e dez', 1_110_110_110_110.por_extenso
|
||||
assert_equal 'um trilhão e cento e onze bilhões e cento e onze milhões e cento e onze mil e cento e onze', 1_111_111_111_111.por_extenso
|
||||
assert_equal 'dez trilhões', 10_000_000_000_000.por_extenso
|
||||
assert_equal 'cem trilhões', 100_000_000_000_000.por_extenso
|
||||
assert_equal 'cento e dez trilhões', 110_000_000_000_000.por_extenso
|
||||
end
|
||||
|
||||
def test_numero_maior_que_trilhao_eh_rejetaido
|
||||
begin
|
||||
1_000_000_000_000_000.por_extenso
|
||||
raise "Deveria lançar RuntimeError com mensagem 'Valor excede o permitido'"
|
||||
rescue RuntimeError => e
|
||||
assert_equal RuntimeError, e.class
|
||||
assert_equal 'Valor excede o permitido: 1000000000000000', e.message
|
||||
end
|
||||
end
|
||||
|
||||
def test_valores_em_real
|
||||
assert_equal 'grátis', 0.por_extenso_em_reais
|
||||
assert_equal 'um centavo', 0.01.por_extenso_em_reais
|
||||
assert_equal 'dois centavos', 0.02.por_extenso_em_reais
|
||||
assert_equal 'vinte e um centavos', 0.21.por_extenso_em_reais
|
||||
assert_equal 'um real', 1.00.por_extenso_em_reais
|
||||
assert_equal 'um real', 1.por_extenso_em_reais
|
||||
assert_equal 'um real e um centavo', 1.01.por_extenso_em_reais
|
||||
assert_equal 'um real e dois centavos', 1.02.por_extenso_em_reais
|
||||
assert_equal 'um milhão de reais e um centavo', 1_000_000.01.por_extenso_em_reais
|
||||
assert_equal 'dois milhões de reais e um centavo', 2_000_000.01.por_extenso_em_reais
|
||||
assert_equal 'dois milhões e duzentos reais e um centavo', 2_000_200.01.por_extenso_em_reais
|
||||
assert_equal 'um bilhão de reais e um centavo', 1_000_000_000.01.por_extenso_em_reais
|
||||
assert_equal 'um trilhão de reais e um centavo', 1_000_000_000_000.01.por_extenso_em_reais
|
||||
assert_equal 'cento e vinte e oito mil e duzentos e quarenta e três reais e vinte e oito centavos', 128_243.28.por_extenso_em_reais
|
||||
assert_equal 'oitenta e dois mil e trezentos e oitenta e nove reais e dezenove centavos', 82_389.19.por_extenso_em_reais
|
||||
assert_equal 'dois mil e trezentos e quarenta e sete reais e vinte e oito centavos', 2_347.28.por_extenso_em_reais
|
||||
assert_equal 'noventa e dois mil e trezentos e setenta e dois reais e oitenta e seis centavos', 92_372.86.por_extenso_em_reais
|
||||
end
|
||||
end
|
@ -1,44 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
||||
|
||||
class StringPortugueseTest < Test::Unit::TestCase
|
||||
def test_nome_proprio
|
||||
assert_equal "Celestino Gomes", "celestino gomes".nome_proprio
|
||||
assert_equal "Celestino da Silva", "celestino da silva".nome_proprio
|
||||
assert_equal "Celestino de Souza", "celestino de souza".nome_proprio
|
||||
assert_equal "Celestino do Carmo", "celestino do carmo".nome_proprio
|
||||
assert_equal "Celestino e Souza", "celestino e souza".nome_proprio
|
||||
assert_equal "Celestino das Couves", "celestino das couves".nome_proprio
|
||||
assert_equal "Celestino dos Santos", "celestino dos santos".nome_proprio
|
||||
assert_equal "Celestino Gomes da Silva de Souza do Carmo e Souza das Couves dos Santos", "celestino gomes da silva de souza do carmo e souza das couves dos santos".nome_proprio
|
||||
assert_equal 'Maria João da Silva', 'MariaJoão da silva'.nome_proprio
|
||||
assert_equal "Átila da Silva", 'átila da silva'.nome_proprio
|
||||
assert_equal "Érica da Silva", 'érica da silva'.nome_proprio
|
||||
assert_equal "Íris Santos", 'íris santos'.nome_proprio
|
||||
|
||||
palavras_excluidas = %w(? ! @ # $ % & * \ / ? , . ; ] [ } { = + 0 1 2 3 4 5 6 7 8 9)
|
||||
|
||||
palavras_excluidas.each do |char|
|
||||
assert_equal char, char.nome_proprio, "Não deveria alterar o caracter '#{char}'"
|
||||
end
|
||||
end
|
||||
|
||||
def test_remover_acentos
|
||||
assert_equal 'aeiouAEIOU', "áéíóúÁÉÍÓÚ".remover_acentos
|
||||
assert_equal 'aeiouAEIOU', "âêîôûÂÊÎÔÛ".remover_acentos
|
||||
assert_equal 'aeiouAEIOU', "àèìòùÀÈÌÒÙ".remover_acentos
|
||||
assert_equal 'aeiouAEIOU', "äëïöüÄËÏÖÜ".remover_acentos
|
||||
assert_equal 'aoAO', "ãõÃÕ".remover_acentos
|
||||
assert_equal 'nN', "ñÑ".remover_acentos
|
||||
assert_equal 'cC', "çÇ".remover_acentos
|
||||
assert_equal 'aeiouAEIOUaeiouAEIOUaeiouAEIOUaeiouAEIOUaoAOnNcC', "áéíóúÁÉÍÓÚâêîôûÂÊÎÔÛàèìòùÀÈÌÒÙäëïöüÄËÏÖÜãõÃÕñÑçÇ".remover_acentos
|
||||
end
|
||||
|
||||
def test_downcase_br
|
||||
assert_equal 'áéíóúâêîôûàèìòùäëïöüãõñç', 'ÁÉÍÓÚÂÊÎÔÛÀÈÌÒÙÄËÏÖÜÃÕÑÇ'.downcase_br
|
||||
end
|
||||
|
||||
def test_upcase_br
|
||||
assert_equal 'ÁÉÍÓÚÂÊÎÔÛÀÈÌÒÙÄËÏÖÜÃÕÑÇ', 'áéíóúâêîôûàèìòùäëïöüãõñç'.upcase_br
|
||||
end
|
||||
|
||||
end
|
@ -1,39 +0,0 @@
|
||||
ENV["RAILS_ENV"] = "test"
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
|
||||
require 'test_help'
|
||||
|
||||
class Test::Unit::TestCase
|
||||
# Transactional fixtures accelerate your tests by wrapping each test method
|
||||
# in a transaction that's rolled back on completion. This ensures that the
|
||||
# test database remains unchanged so your fixtures don't have to be reloaded
|
||||
# between every test method. Fewer database queries means faster tests.
|
||||
#
|
||||
# Read Mike Clark's excellent walkthrough at
|
||||
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
||||
#
|
||||
# Every Active Record database supports transactions except MyISAM tables
|
||||
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
||||
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
||||
# is recommended.
|
||||
self.use_transactional_fixtures = true
|
||||
|
||||
# Instantiated fixtures are slow, but give you @david where otherwise you
|
||||
# would need people(:david). If you don't want to migrate your existing
|
||||
# test cases which use the @david style and don't mind the speed hit (each
|
||||
# instantiated fixtures translates to a database query per test method),
|
||||
# then set this back to true.
|
||||
self.use_instantiated_fixtures = false
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../init")
|
||||
require 'inflector_portuguese'
|
||||
|
||||
def tornar_metodos_publicos(clazz)
|
||||
clazz.class_eval do
|
||||
private_instance_methods.each { |instance_method| public instance_method }
|
||||
private_methods.each { |method| public_class_method method }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,64 +0,0 @@
|
||||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class TimeTest < Test::Unit::TestCase
|
||||
|
||||
#to_s
|
||||
def test_time_to_s_with_traditional_format
|
||||
assert_equal "Mon Sep 24 16:03:05 UTC 2007", "Mon Sep 24 16:03:05 UTC 2007".to_time.to_s
|
||||
end
|
||||
|
||||
#to_s_br
|
||||
def test_time_to_s_br
|
||||
assert_equal "24/09/2007 16:03", "Mon Sep 24 16:03:05 UTC 2007".to_time.to_s_br
|
||||
end
|
||||
|
||||
def test_month_names
|
||||
assert_equal [nil,
|
||||
"Janeiro",
|
||||
"Fevereiro",
|
||||
"Março",
|
||||
"Abril",
|
||||
"Maio",
|
||||
"Junho",
|
||||
"Julho",
|
||||
"Agosto",
|
||||
"Setembro",
|
||||
"Outubro",
|
||||
"Novembro",
|
||||
"Dezembro"],
|
||||
Time::MONTHNAMES
|
||||
end
|
||||
|
||||
def test_days_names
|
||||
assert_equal ["Domingo",
|
||||
"Segunda-Feira",
|
||||
"Terca-Feira",
|
||||
"Quarta-Feira",
|
||||
"Quinta-Feira",
|
||||
"Sexta-Feira",
|
||||
"Sabado"],
|
||||
Time::DAYNAMES
|
||||
end
|
||||
|
||||
def test_abbr_monthnames
|
||||
assert_equal [nil,
|
||||
"Jan",
|
||||
"Fev",
|
||||
"Mar",
|
||||
"Abr",
|
||||
"Mai",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Ago",
|
||||
"Set",
|
||||
"Out",
|
||||
"Nov",
|
||||
"Dez"],
|
||||
Time::ABBR_MONTHNAMES
|
||||
end
|
||||
|
||||
def test_abbr_daysnames
|
||||
assert_equal ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"], Time::ABBR_DAYNAMES
|
||||
end
|
||||
|
||||
end
|
@ -1 +0,0 @@
|
||||
# Uninstall hook code here
|
Reference in new issue