Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
fixes para ruby 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fmluizao committed Aug 28, 2009
1 parent 42eae32 commit 9eaa0a0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions brcep/lib/brcep/busca_endereco.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
require 'net/http'
require 'rexml/document'

Expand Down
3 changes: 2 additions & 1 deletion brdata/lib/brdata.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

Expand Down Expand Up @@ -40,4 +41,4 @@ module BrData
Date::FERIADOS.clear
Date::FERIADOS_METODOS.clear
feriados.each { |f| Date::FERIADOS << f }
metodos.each { |m| Date::FERIADOS_METODOS << m }
metodos.each { |m| Date::FERIADOS_METODOS << m }
3 changes: 2 additions & 1 deletion brdata/lib/brdata/br_date_helper.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
module ActionView::Helpers::DateHelper
# Traduz o método distance_of_time_in_words para retornar esse valor em português
#
Expand Down Expand Up @@ -30,4 +31,4 @@ def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
else "mais de #{(distance_in_minutes / 525960).round} anos"
end
end
end
end
1 change: 1 addition & 0 deletions brdata/lib/brdata/excecoes.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
def cria_excecao(classe, mensagem)
eval "class #{classe}; def initialize; super('#{mensagem}'); end; end"
end
Expand Down
1 change: 1 addition & 0 deletions brhelper/lib/brhelper/br_form_options_helper.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
module ActionView::Helpers::FormOptionsHelper
ESTADOS_BRASILEIROS = [["Acre", "AC"],
["Alagoas", "AL"],
Expand Down
19 changes: 10 additions & 9 deletions brnumeros/lib/brnumeros/number_portuguese.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
module Extenso
@@unidade = {
0 => "zero",
Expand Down Expand Up @@ -60,12 +61,12 @@ def por_extenso
# Extenso.por_extenso(100) ==> "cem"
# Extenso.por_extenso(158) ==> "cento e cinquenta e oito"
def Extenso.por_extenso(numero)
negativo=(numero<0)?"menos ":""
negativo=(numero<0)? "menos " : ""
n=numero.to_i.abs
return case n
when 0..9: negativo + @@unidade[n].to_s
when 10..19: negativo + @@dezena[n].to_s
when 20..99:
when 0..9 then negativo + @@unidade[n].to_s
when 10..19 then negativo + @@dezena[n].to_s
when 20..99
v=n % 10
if v== 0
negativo + @@dezena[n].to_s
Expand Down Expand Up @@ -121,8 +122,8 @@ def por_extenso_em_reais
# 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)
negativo=(valor<0)?" negativo":""
negativos=(valor<0)?" negativos":""
negativo=(valor<0)? " negativo" : ""
negativos=(valor<0)? " negativos" : ""
valor = valor.abs
return 'grátis' if valor == 0
case valor
Expand All @@ -138,9 +139,9 @@ def ExtensoReal.por_extenso_em_reais(valor)
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"
when 0 then ""
when 1 then " centavo"
when 2..99 then " centavos"
end

if real.to_i > 0
Expand Down
1 change: 1 addition & 0 deletions brstring/lib/brstring/string_portuguese.rb
@@ -1,3 +1,4 @@
# encoding: UTF-8
class String
MINUSCULAS_COM_ACENTO = 'áéíóúâêîôûàèìòùäëïöüãõñç'
MAIUSCULAS_COM_ACENTO = 'ÁÉÍÓÚÂÊÎÔÛÀÈÌÒÙÄËÏÖÜÃÕÑÇ'
Expand Down

0 comments on commit 9eaa0a0

Please sign in to comment.