Class: Yage::Data
- Inherits:
-
Struct
- Object
- Struct
- Yage::Data
- Defined in:
- lib/yage/data.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#dist ⇒ Object
Returns the value of attribute dist.
-
#mday ⇒ Object
Returns the value of attribute mday.
-
#month ⇒ Object
Returns the value of attribute month.
-
#yday ⇒ Object
Returns the value of attribute yday.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #age_yday ⇒ Object
-
#format(str, *args) ⇒ Object
format by following variable - %year - %month - %mday - %yday ex) format(“v%year.%month.%mday”).
- #semver ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base
2 3 4 |
# File 'lib/yage/data.rb', line 2 def base @base end |
#dist ⇒ Object
Returns the value of attribute dist
2 3 4 |
# File 'lib/yage/data.rb', line 2 def dist @dist end |
#mday ⇒ Object
Returns the value of attribute mday
2 3 4 |
# File 'lib/yage/data.rb', line 2 def mday @mday end |
#month ⇒ Object
Returns the value of attribute month
2 3 4 |
# File 'lib/yage/data.rb', line 2 def month @month end |
#yday ⇒ Object
Returns the value of attribute yday
2 3 4 |
# File 'lib/yage/data.rb', line 2 def yday @yday end |
#year ⇒ Object
Returns the value of attribute year
2 3 4 |
# File 'lib/yage/data.rb', line 2 def year @year end |
Instance Method Details
#age_yday ⇒ Object
25 26 27 |
# File 'lib/yage/data.rb', line 25 def age_yday format("v%d.%03d", year, yday) end |
#format(str, *args) ⇒ Object
format by following variable
- %year
- %month
- %mday
- %yday
ex) format(“v%year.%month.%mday”)
13 14 15 16 17 18 19 |
# File 'lib/yage/data.rb', line 13 def format(str, *args) str.gsub!(/%year/, year.to_s) str.gsub!(/%month/, month.to_s) str.gsub!(/%mday/, mday.to_s) str.gsub!(/%yday/, yday.to_s) sprintf str, *args end |
#semver ⇒ Object
21 22 23 |
# File 'lib/yage/data.rb', line 21 def semver format("v%year.%month.%mday") end |
#to_s ⇒ Object
3 4 5 |
# File 'lib/yage/data.rb', line 3 def to_s "#{year} year#{year > 1 ? "s" : ""}" end |