Class: Yage::Data

Inherits:
Struct
  • Object
show all
Defined in:
lib/yage/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseObject

Returns the value of attribute base

Returns:

  • (Object)

    the current value of base



2
3
4
# File 'lib/yage/data.rb', line 2

def base
  @base
end

#distObject

Returns the value of attribute dist

Returns:

  • (Object)

    the current value of dist



2
3
4
# File 'lib/yage/data.rb', line 2

def dist
  @dist
end

#mdayObject

Returns the value of attribute mday

Returns:

  • (Object)

    the current value of mday



2
3
4
# File 'lib/yage/data.rb', line 2

def mday
  @mday
end

#monthObject

Returns the value of attribute month

Returns:

  • (Object)

    the current value of month



2
3
4
# File 'lib/yage/data.rb', line 2

def month
  @month
end

#ydayObject

Returns the value of attribute yday

Returns:

  • (Object)

    the current value of yday



2
3
4
# File 'lib/yage/data.rb', line 2

def yday
  @yday
end

#yearObject

Returns the value of attribute year

Returns:

  • (Object)

    the current value of year



2
3
4
# File 'lib/yage/data.rb', line 2

def year
  @year
end

Instance Method Details

#age_ydayObject



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

#semverObject



21
22
23
# File 'lib/yage/data.rb', line 21

def semver
  format("v%year.%month.%mday")
end

#to_sObject



3
4
5
# File 'lib/yage/data.rb', line 3

def to_s
  "#{year} year#{year > 1 ? "s" : ""}"
end