Class: Build::Dependency::Depends

Inherits:
Struct
  • Object
show all
Defined in:
lib/build/dependency/provider.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, **options) ⇒ Depends

Returns a new instance of Depends.


77
78
79
# File 'lib/build/dependency/provider.rb', line 77

def initialize(name, **options)
	super(name, options)
end

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name


76
77
78
# File 'lib/build/dependency/provider.rb', line 76

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options


76
77
78
# File 'lib/build/dependency/provider.rb', line 76

def options
  @options
end

Class Method Details

.[](name_or_dependency) ⇒ Object


116
117
118
# File 'lib/build/dependency/provider.rb', line 116

def [](name_or_dependency)
	name_or_dependency.is_a?(self) ? name_or_dependency : self.new(name_or_dependency)
end

Instance Method Details

#alias?Boolean

Returns:

  • (Boolean)

109
110
111
# File 'lib/build/dependency/provider.rb', line 109

def alias?
	name.is_a?(Symbol)
end

#match?(name) ⇒ Boolean

Returns:

  • (Boolean)

85
86
87
88
89
90
91
# File 'lib/build/dependency/provider.rb', line 85

def match?(name)
	if wildcard? and name.is_a?(String)
		File.fnmatch?(self.name, name)
	else
		self.name == name
	end
end

#private?Boolean

Returns:

  • (Boolean)

105
106
107
# File 'lib/build/dependency/provider.rb', line 105

def private?
	!!options[:private]
end

#public?Boolean

Returns:

  • (Boolean)

101
102
103
# File 'lib/build/dependency/provider.rb', line 101

def public?
	!!options[:public]
end

#to_sObject


93
94
95
96
97
98
99
# File 'lib/build/dependency/provider.rb', line 93

def to_s
	if options.any?
		"depends on #{name.inspect} #{options.inspect}"
	else
		"depends on #{name.inspect}"
	end
end

#wildcard?Boolean

Returns:

  • (Boolean)

81
82
83
# File 'lib/build/dependency/provider.rb', line 81

def wildcard?
	self.name.is_a?(String) and self.name.include?('*')
end