class Souffle::Node::RunListItem

A single runlist item, most be parsed and either a recipe or role.

Public Class Methods

new(item=nil) click to toggle source

Creates a new runlist item from a string.

@param [ String ] item The runlist string to turn into an object. @raise [ InvalidRunlistName, InvalidRunlistType ] Raises exceptions when the runlist item or type isn't a proper chef role or recipe.

# File lib/souffle/node/runlist_item.rb, line 11
def initialize(item=nil)
  @original_item = item
  @item = Souffle::Node::RunListParser.parse(item)
end

Public Instance Methods

==(runlist_item) click to toggle source

Overriding the default equality comparator to use string representation.

@param [ Souffle::Node::RunListItem ] runlist_item

@return [ Boolean ] Whether or not the objects are equal.

# File lib/souffle/node/runlist_item.rb, line 40
def ==(runlist_item)
  self.to_s == runlist_item.to_s
end
eql?(runlist_item) click to toggle source

Overriding the default equality comparator to use string representation.

@param [ Souffle::Node::RunListItem ] runlist_item

@return [ Boolean ] Whether or not the objects are equal.

# File lib/souffle/node/runlist_item.rb, line 49
def eql?(runlist_item)
  self.to_s == runlist_item.to_s
end
name() click to toggle source

Returns the name of the runlist item.

@return [ String ] The name of the runlist item.

# File lib/souffle/node/runlist_item.rb, line 19
def name
  @item["name"]
end
to_s() click to toggle source

Returns the RunListItem as it's original string.

# File lib/souffle/node/runlist_item.rb, line 31
def to_s
  @original_item
end
type() click to toggle source

Returns the type of the runlist item.

@return [ String ] The type of the runlist item.

# File lib/souffle/node/runlist_item.rb, line 26
def type
  @item["type"]
end