Class: IronHammer::Version
- Inherits:
-
Object
- Object
- IronHammer::Version
- Defined in:
- lib/iron_hammer/version.rb
Instance Attribute Summary collapse
-
#build_number ⇒ Object
Returns the value of attribute build_number.
-
#built_by ⇒ Object
Returns the value of attribute built_by.
-
#control_hash ⇒ Object
Returns the value of attribute control_hash.
-
#major ⇒ Object
Returns the value of attribute major.
-
#minor ⇒ Object
Returns the value of attribute minor.
-
#revision ⇒ Object
Returns the value of attribute revision.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #create!(path, name = 'version.yaml') ⇒ Object
-
#initialize(params = {}) ⇒ Version
constructor
A new instance of Version.
- #to_yaml ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Version
Returns a new instance of Version.
14 15 16 17 18 19 20 21 22 |
# File 'lib/iron_hammer/version.rb', line 14 def initialize params={} @major = params[:major] || '#' @minor = params[:minor] || '#' @revision = params[:revision] || '#' @build_number = params[:build_number] || '##' @control_hash = params[:control_hash] || '**********' @built_by = params[:built_by] || 'MACSkeptic Iron Hammer' @timestamp = params[:timestamp] || Time.now.strftime('%Y-%m-%d %H:%M:%S') end |
Instance Attribute Details
#build_number ⇒ Object
Returns the value of attribute build_number.
6 7 8 |
# File 'lib/iron_hammer/version.rb', line 6 def build_number @build_number end |
#built_by ⇒ Object
Returns the value of attribute built_by.
9 10 11 |
# File 'lib/iron_hammer/version.rb', line 9 def built_by @built_by end |
#control_hash ⇒ Object
Returns the value of attribute control_hash.
7 8 9 |
# File 'lib/iron_hammer/version.rb', line 7 def control_hash @control_hash end |
#major ⇒ Object
Returns the value of attribute major.
10 11 12 |
# File 'lib/iron_hammer/version.rb', line 10 def major @major end |
#minor ⇒ Object
Returns the value of attribute minor.
11 12 13 |
# File 'lib/iron_hammer/version.rb', line 11 def minor @minor end |
#revision ⇒ Object
Returns the value of attribute revision.
12 13 14 |
# File 'lib/iron_hammer/version.rb', line 12 def revision @revision end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
8 9 10 |
# File 'lib/iron_hammer/version.rb', line 8 def @timestamp end |
Instance Method Details
#create!(path, name = 'version.yaml') ⇒ Object
33 34 35 |
# File 'lib/iron_hammer/version.rb', line 33 def create! path, name='version.yaml' IronHammer::Utils::FileSystem::write! :path => path, :name => name, :content => to_yaml end |
#to_yaml ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/iron_hammer/version.rb', line 24 def to_yaml { 'Version' => { 'Major' => @major, 'Minor' => @minor, 'Revision' => @revision }, 'Build' => { 'Number' => @build_number, 'Hash' => @control_hash }, 'Timestamp' => @timestamp, 'Built By' => @built_by }.to_yaml end |