yesno 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +48 -16
  2. data/lib/yesno/version.rb +1 -1
  3. metadata +4 -4
@@ -10,15 +10,19 @@ Yesno is a simple utility for boolean case.
10
10
  gem install yesno
11
11
  rails generate yesno:install
12
12
 
13
- == Example:
13
+ == standard implementation
14
+
15
+ === Example:
14
16
 
15
17
  if @article.active is false
16
18
 
19
+ # yesno(@article.active) -> "false"
17
20
  # yesno(@article.active, :type => "atc") -> "inactive"
18
21
 
19
22
  if @person.sex is true
20
23
 
21
24
  # yesno(@person.sex, :type => "mf") -> "male"
25
+ # yesno(@person.sex, :type => "mf", :pluralize => true) -> "man"
22
26
 
23
27
 
24
28
  the options are
@@ -26,23 +30,51 @@ the options are
26
30
  :female => true/false
27
31
  :pluralize => true/false
28
32
 
33
+ the types are
34
+ "default" (true/false)
35
+ "yn" (yes/no)
36
+ "mf" (male/female)
37
+ "act" (active/inactive)
38
+
39
+ == fast implementation
40
+ Fyesno is a more fast implementation of yesno.
41
+ Fyesno" solves the conversion with a single "if" using the options to address directly the translation.
42
+
43
+ # fyesno(to_validate, type, option)
44
+
45
+ where default type is "default" and default option is "ms".
46
+ "option" is a string containing the two letters to this standard:
47
+ "ms" masculine singular
48
+ "mp" masculine plural
49
+ "fs" feminine singular
50
+ "fp" feminine plural
51
+
52
+ === Example
53
+
54
+ if @var.test is true
55
+ # fyesno(@var.test) -> "true"
56
+ # fyesno(@var.test, "mf", "mp") -> "man"
57
+ # fyesno(@var.test, "act", "fp") -> "actives"
58
+
59
+ == extend the types
60
+
29
61
  To add new features just edit the file yesno.#{lang}.yml and add new implementations:
30
62
 
31
- it:
32
- yesno:
33
- default:
34
- smt: "vero"
35
- smf: "falso"
36
- sft: "vera"
37
- sff: "falsa"
38
- pmt: "veri"
39
- pmf: "falsi"
40
- pft: "vere"
41
- pff: "false"
42
- yn:
43
- smt: "si"
44
- smf: "no"
45
- ecc.....
63
+ it:
64
+ yesno:
65
+ default:
66
+ smt: "vero"
67
+ smf: "falso"
68
+ sft: "vera"
69
+ sff: "falsa"
70
+ pmt: "veri"
71
+ pmf: "falsi"
72
+ pft: "vere"
73
+ pff: "false"
74
+ yn:
75
+ smt: "si"
76
+ smf: "no"
77
+ ecc.....
46
78
 
47
79
  - the type of translation is the third indentation
48
80
  - the translation is the fourth indentation
@@ -1,3 +1,3 @@
1
1
  module Yesno
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yesno
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,15 +13,15 @@ date: 2012-01-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &7568840 !ruby/object:Gem::Requirement
16
+ requirement: &7568740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *7568840
24
+ version_requirements: *7568740
25
25
  description: Boolean helper fot rails
26
26
  email:
27
27
  - andrea.ranaldi@gmail.com