Class: Dependency
- Inherits:
-
Object
- Object
- Dependency
- Defined in:
- lib/simple-make/dependency.rb
Instance Attribute Summary collapse
-
#include ⇒ Object
readonly
Returns the value of attribute include.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(map) ⇒ Dependency
constructor
A new instance of Dependency.
- #lib_name ⇒ Object
- #lib_path ⇒ Object
Constructor Details
#initialize(map) ⇒ Dependency
Returns a new instance of Dependency.
3 4 5 6 7 8 9 |
# File 'lib/simple-make/dependency.rb', line 3 def initialize map raise wrong_format_msg(map) if !(map.is_a? Hash) or map[:include].nil? or map[:lib].nil? @include = File.absolute_path(map[:include]) @lib = File.absolute_path(map[:lib]) @scope = map[:scope] || :compile end |
Instance Attribute Details
#include ⇒ Object (readonly)
Returns the value of attribute include.
2 3 4 |
# File 'lib/simple-make/dependency.rb', line 2 def include @include end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
2 3 4 |
# File 'lib/simple-make/dependency.rb', line 2 def scope @scope end |
Instance Method Details
#lib_name ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/simple-make/dependency.rb', line 11 def lib_name if @lib_name.nil? matches = @lib.match /.*\/lib([^\/]*)\.a/ raise "lib name format is wrong, it should be [libxxx.a]" if matches.nil? @lib_name = matches[1] raise "lib name format is wrong, it should be [libxxx.a], and the xxx should not be empty" if @lib_name.empty? end @lib_name end |
#lib_path ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/simple-make/dependency.rb', line 21 def lib_path if @lib_path.nil? matches = @lib.match /(.*\/)[^\/]*/ @lib_path = matches[1] end @lib_path end |