Class: Dependency
- Inherits:
-
Object
- Object
- Dependency
- Includes:
- PathHelper
- 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, path_mode = :absolute) ⇒ Dependency
constructor
A new instance of Dependency.
- #lib_name ⇒ Object
- #lib_path ⇒ Object
Methods included from PathHelper
Constructor Details
#initialize(map, path_mode = :absolute) ⇒ Dependency
Returns a new instance of Dependency.
7 8 9 10 11 12 13 |
# File 'lib/simple-make/dependency.rb', line 7 def initialize map, path_mode = :absolute raise wrong_format_msg(map) if !(map.is_a? Hash) or map[:include].nil? or map[:lib].nil? @include = get_path(path_mode, map[:include]) @lib = get_path(path_mode, map[:lib]) @scope = map[:scope] || :compile end |
Instance Attribute Details
#include ⇒ Object (readonly)
Returns the value of attribute include.
5 6 7 |
# File 'lib/simple-make/dependency.rb', line 5 def include @include end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
5 6 7 |
# File 'lib/simple-make/dependency.rb', line 5 def scope @scope end |
Instance Method Details
#lib_name ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/simple-make/dependency.rb', line 15 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
25 26 27 28 29 30 31 |
# File 'lib/simple-make/dependency.rb', line 25 def lib_path if @lib_path.nil? matches = @lib.match /(.*\/)[^\/]*/ @lib_path = matches[1] end @lib_path end |