Module: Agery
- Defined in:
- lib/agery.rb,
lib/agery/version.rb
Constant Summary collapse
- AGE_OVER =
/^over_(0|[1-9]\d*)$/.freeze
- AGE_UNDER =
/^under_([1-9]\d*)$/.freeze
- VERSION =
"2.0.0"
Class Attribute Summary collapse
-
.adult ⇒ Object
Returns the value of attribute adult.
-
.child ⇒ Object
Returns the value of attribute child.
-
.infant ⇒ Object
Returns the value of attribute infant.
-
.senior ⇒ Object
Returns the value of attribute senior.
-
.teenager ⇒ Object
Returns the value of attribute teenager.
Instance Method Summary collapse
- #adults ⇒ Object (also: #adult)
- #children ⇒ Object (also: #child)
- #infants ⇒ Object (also: #infant)
- #method_missing(method) ⇒ Object
- #respond_to?(method) ⇒ Boolean
- #seniors ⇒ Object (also: #senior)
- #teenagers ⇒ Object (also: #teenager)
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Class Attribute Details
.adult ⇒ Object
Returns the value of attribute adult.
12 13 14 |
# File 'lib/agery.rb', line 12 def adult @adult end |
.child ⇒ Object
Returns the value of attribute child.
12 13 14 |
# File 'lib/agery.rb', line 12 def child @child end |
.infant ⇒ Object
Returns the value of attribute infant.
12 13 14 |
# File 'lib/agery.rb', line 12 def infant @infant end |
.senior ⇒ Object
Returns the value of attribute senior.
12 13 14 |
# File 'lib/agery.rb', line 12 def senior @senior end |
.teenager ⇒ Object
Returns the value of attribute teenager.
12 13 14 |
# File 'lib/agery.rb', line 12 def teenager @teenager end |
Instance Method Details
#adults ⇒ Object Also known as: adult
15 16 17 |
# File 'lib/agery.rb', line 15 def adults to_age_a Agery.adult end |
#children ⇒ Object Also known as: child
25 26 27 |
# File 'lib/agery.rb', line 25 def children to_age_a Agery.child end |
#infants ⇒ Object Also known as: infant
20 21 22 |
# File 'lib/agery.rb', line 20 def infants to_age_a Agery.infant end |
#respond_to?(method) ⇒ Boolean
40 41 42 |
# File 'lib/agery.rb', line 40 def respond_to?(method, *) super || AGE_OVER === method.to_s || AGE_UNDER === method.to_s end |