Class: Kennel::Models::Project
- Defined in:
- lib/kennel/models/project.rb
Defined Under Namespace
Classes: FileLocationNotFound
Constant Summary collapse
- GEM_LIB =
File.("..", __dir__)
Constants inherited from Base
Base::SETTING_OVERRIDABLE_METHODS
Constants included from SettingsAsMethods
SettingsAsMethods::AS_PROCS, SettingsAsMethods::SETTING_OVERRIDABLE_METHODS
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Methods included from SubclassTracking
#abstract_class?, #recursive_subclasses, #subclasses
Methods included from SettingsAsMethods
included, #initialize, #raise_with_location
Class Method Details
.file_location ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kennel/models/project.rb', line 16 def self.file_location return @file_location if defined?(@file_location) methods = instance_methods(false) if methods.any? @file_location = methods.detect do |method| location = instance_method(method).source_location.first # methods created by `settings` point inside this gem, which is not the project file next if location.start_with?("#{GEM_LIB}/") if (path = find_relative_path(location)) break path end end || raise(FileLocationNotFound, "Unable to find file_location for #{name}") else @file_location = nil # not sure if this is actually needed end end |
Instance Method Details
#validated_parts ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/kennel/models/project.rb', line 33 def validated_parts all = filter_parts(parts) unless all.is_a?(Array) && all.all? { |part| part.is_a?(Record) } raise "Project #{kennel_id} #parts must return an array of Records" end validate_parts(all) all end |