ciuchcia 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +4 -0
- data/config/name_days.yml +1477 -0
- data/config/name_days_full.yml +2227 -0
- data/lib/ciuchcia.rb +1 -1
- data/lib/ciuchcia/base.rb +9 -0
- data/lib/ciuchcia/date.rb +15 -6
- data/lib/ciuchcia/distance_of_time.rb +5 -11
- data/lib/ciuchcia/name_days.rb +26 -0
- metadata +6 -2
data/lib/ciuchcia.rb
CHANGED
data/lib/ciuchcia/date.rb
CHANGED
@@ -1,12 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class CiuchciaDate < Date
|
1
|
+
module Ciuchcia
|
2
|
+
class Date
|
4
3
|
MONTHNAMES = [nil] + %w{Styczeń Luty Marzec Kwiecień Maj Czerwiec Lipiec Sierpień Wrzesień Październik Listopad Grudzień}
|
4
|
+
ABBR_MONTHNAMES = [nil] + %w{Sty Lut Mar Kwi Maj Cze Lip Sie Wrz Paź Lis Gru}
|
5
5
|
DAYNAMES = ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"]
|
6
|
+
ABBR_DAYNAMES = ["Nie", "Pon", "Wto", "Śro", "Czw", "Pią", "Sob"]
|
6
7
|
end
|
8
|
+
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
Date = CiuchciaDate
|
10
|
+
class Time
|
11
|
+
alias :strftime_nolocale :strftime
|
11
12
|
|
13
|
+
def strftime(format)
|
14
|
+
format = format.dup
|
15
|
+
format.gsub!(/%a/, Ciuchcia::Date::ABBR_DAYNAMES[self.wday])
|
16
|
+
format.gsub!(/%A/, Ciuchcia::Date::DAYNAMES[self.wday])
|
17
|
+
format.gsub!(/%b/, Ciuchcia::Date::ABBR_MONTHNAMES[self.mon])
|
18
|
+
format.gsub!(/%B/, Ciuchcia::Date::MONTHNAMES[self.mon])
|
19
|
+
self.strftime_nolocale(format)
|
20
|
+
end
|
12
21
|
end
|
@@ -8,13 +8,7 @@ module ActionView
|
|
8
8
|
distance_in_minutes = (((to_time - from_time).abs)/60).round
|
9
9
|
distance_in_seconds = ((to_time - from_time).abs).round
|
10
10
|
|
11
|
-
|
12
|
-
case (n % 10)
|
13
|
-
when 1: n > 10 ? endings[2] : endings[0]
|
14
|
-
when 2..4: endings[1]
|
15
|
-
else endings[2]
|
16
|
-
end
|
17
|
-
end
|
11
|
+
|
18
12
|
|
19
13
|
case distance_in_minutes
|
20
14
|
when 0..1
|
@@ -28,15 +22,15 @@ module ActionView
|
|
28
22
|
else '1 minuta'
|
29
23
|
end
|
30
24
|
|
31
|
-
when 2..44 then "#{distance_in_minutes} #{polish_ending(distance_in_minutes,['minuta','minuty','minut'])}"
|
25
|
+
when 2..44 then "#{distance_in_minutes} #{Ciuchcia::polish_ending(distance_in_minutes,['minuta','minuty','minut'])}"
|
32
26
|
when 45..89 then 'około godzina'
|
33
|
-
when 90..1439 then "około #{(distance_in_minutes.to_f / 60.0).round} #{polish_ending((distance_in_minutes.to_f / 60.0).round,['godzina','godziny','godzin'])}"
|
27
|
+
when 90..1439 then "około #{(distance_in_minutes.to_f / 60.0).round} #{Ciuchcia::polish_ending((distance_in_minutes.to_f / 60.0).round,['godzina','godziny','godzin'])}"
|
34
28
|
when 1440..2879 then '1 dzień'
|
35
29
|
when 2880..43199 then "#{(distance_in_minutes / 1440).round} dni"
|
36
30
|
when 43200..86399 then 'około 1 miesiąc'
|
37
|
-
when 86400..525599 then "#{(distance_in_minutes / 43200).round} #{polish_ending((distance_in_minutes / 43200).round,['miesiąc','miesiące','miesięcy'])}"
|
31
|
+
when 86400..525599 then "#{(distance_in_minutes / 43200).round} #{Ciuchcia::polish_ending((distance_in_minutes / 43200).round,['miesiąc','miesiące','miesięcy'])}"
|
38
32
|
when 525600..1051199 then 'około rok'
|
39
|
-
else "ponad #{(distance_in_minutes / 525600).round} #{polish_ending((distance_in_minutes / 525600).round,['rok','lata','lat'])}"
|
33
|
+
else "ponad #{(distance_in_minutes / 525600).round} #{Ciuchcia::polish_ending((distance_in_minutes / 525600).round,['rok','lata','lat'])}"
|
40
34
|
end
|
41
35
|
end
|
42
36
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Ciuchcia
|
4
|
+
class NameDays
|
5
|
+
|
6
|
+
def self.list
|
7
|
+
@@name_days = YAML.load_file(File.join(File.expand_path(File.dirname(__FILE__)),'..','..','config','name_days.yml' ))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.today
|
11
|
+
t = Time.now
|
12
|
+
list[t.month][t.day]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.list_full
|
16
|
+
@@name_days = YAML.load_file(File.join(File.expand_path(File.dirname(__FILE__)),'..','..','config','name_days_full.yml' ))
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.today_full
|
20
|
+
t = Time.now
|
21
|
+
list_full[t.month][t.day]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ciuchcia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Kacper Cie\xC5\x9Bla"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-18 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,11 +27,15 @@ files:
|
|
27
27
|
- Manifest.txt
|
28
28
|
- README.txt
|
29
29
|
- Rakefile
|
30
|
+
- config/name_days.yml
|
31
|
+
- config/name_days_full.yml
|
30
32
|
- config/vulgar_words.yml
|
31
33
|
- lib/ciuchcia.rb
|
34
|
+
- lib/ciuchcia/base.rb
|
32
35
|
- lib/ciuchcia/date.rb
|
33
36
|
- lib/ciuchcia/distance_of_time.rb
|
34
37
|
- lib/ciuchcia/error_messages_for.rb
|
38
|
+
- lib/ciuchcia/name_days.rb
|
35
39
|
- lib/ciuchcia/number_in_words.rb
|
36
40
|
- lib/ciuchcia/profanity.rb
|
37
41
|
- lib/ciuchcia/validations.rb
|