Class: Serverspec::Type::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/serverspec/type/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ Base

Returns a new instance of Base.


4
5
6
# File 'lib/serverspec/type/base.rb', line 4

def initialize(name=nil)
  @name = name
end

Instance Method Details

#to_aryObject


17
18
19
# File 'lib/serverspec/type/base.rb', line 17

def to_ary
  to_s.split(" ")
end

#to_sObject Also known as: inspect


8
9
10
11
12
13
# File 'lib/serverspec/type/base.rb', line 8

def to_s
  type = self.class.name.split(':')[-1]
  type.gsub!(/([a-z\d])([A-Z])/, '\1 \2')
  type.capitalize!
  %Q!#{type} "#{@name}"!
end