Class: IncludeFactory
- Defined in:
- lib/ceedling/includes/include_factory.rb
Instance Method Summary collapse
- #system_include_from_directive(directive) ⇒ Object
- #system_include_from_filepath(filepath) ⇒ Object
- #user_include_from_directive(directive) ⇒ Object
- #user_include_from_filepath(filepath) ⇒ Object
Instance Method Details
#system_include_from_directive(directive) ⇒ Object
32 33 34 35 36 |
# File 'lib/ceedling/includes/include_factory.rb', line 32 def system_include_from_directive(directive) results = directive.match(PATTERNS::SYSTEM_INCLUDE_DIRECTIVE_FILENAME) return system_include_from_filepath( results[1] ) if !results.nil? return nil end |
#system_include_from_filepath(filepath) ⇒ Object
38 39 40 41 |
# File 'lib/ceedling/includes/include_factory.rb', line 38 def system_include_from_filepath(filepath) # Just a light wrapper anticipating more complexities later on return SystemInclude.new(filepath) end |
#user_include_from_directive(directive) ⇒ Object
15 16 17 18 19 |
# File 'lib/ceedling/includes/include_factory.rb', line 15 def user_include_from_directive(directive) results = directive.match(PATTERNS::USER_INCLUDE_DIRECTIVE_FILENAME) return user_include_from_filepath( results[1] ) if !results.nil? return nil end |
#user_include_from_filepath(filepath) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ceedling/includes/include_factory.rb', line 21 def user_include_from_filepath(filepath) if File.basename(filepath).start_with?( @configurator.cmock_mock_prefix ) # Remove any build directory path that snuck into mock handling. # This can happen from discovering an empty mock stand-in or previously generated mock files. # This regex matches the base build mocks directory and any test name subdirectory beneath it. _filepath = filepath.sub( /^#{Regexp.escape( @configurator.cmock_mock_path )}\/[^\/]+\//, '' ) return MockInclude.new(_filepath) end return UserInclude.new(filepath) end |