Class: Build::Dependency::Depends
- Inherits:
-
Struct
- Object
- Struct
- Build::Dependency::Depends
- Defined in:
- lib/build/dependency/provider.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #alias? ⇒ Boolean
-
#initialize(name, **options) ⇒ Depends
constructor
A new instance of Depends.
- #match?(name) ⇒ Boolean
- #private? ⇒ Boolean
- #public? ⇒ Boolean
- #to_s ⇒ Object
- #wildcard? ⇒ Boolean
Constructor Details
#initialize(name, **options) ⇒ Depends
Returns a new instance of Depends.
77 78 79 80 81 |
# File 'lib/build/dependency/provider.rb', line 77 def initialize(name, **) super(name) @options = end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
76 77 78 |
# File 'lib/build/dependency/provider.rb', line 76 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
95 96 97 |
# File 'lib/build/dependency/provider.rb', line 95 def @options end |
Class Method Details
.[](name_or_dependency) ⇒ Object
120 121 122 |
# File 'lib/build/dependency/provider.rb', line 120 def [](name_or_dependency) name_or_dependency.is_a?(self) ? name_or_dependency : self.new(name_or_dependency) end |
Instance Method Details
#alias? ⇒ Boolean
113 114 115 |
# File 'lib/build/dependency/provider.rb', line 113 def alias? name.is_a?(Symbol) end |
#match?(name) ⇒ Boolean
87 88 89 90 91 92 93 |
# File 'lib/build/dependency/provider.rb', line 87 def match?(name) if wildcard? and name.is_a?(String) File.fnmatch?(self.name, name) else self.name == name end end |
#private? ⇒ Boolean
109 110 111 |
# File 'lib/build/dependency/provider.rb', line 109 def private? !!@options[:private] end |
#public? ⇒ Boolean
105 106 107 |
# File 'lib/build/dependency/provider.rb', line 105 def public? !!@options[:public] end |
#to_s ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/build/dependency/provider.rb', line 97 def to_s if @options.any? "depends on #{name.inspect} #{@options.inspect}" else "depends on #{name.inspect}" end end |
#wildcard? ⇒ Boolean
83 84 85 |
# File 'lib/build/dependency/provider.rb', line 83 def wildcard? self.name.is_a?(String) and self.name.include?('*') end |