Class: Kennel::Models::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/kennel/models/project.rb

Constant Summary

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

#kennel_id, #name, #to_json

Methods included from SubclassTracking

#abstract_class?, #recursive_subclasses, #subclasses

Methods included from SettingsAsMethods

included, #initialize, #raise_with_location

Class Method Details

.file_locationObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kennel/models/project.rb', line 11

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
      if (path = find_relative_path(location))
        break path
      end
    end || raise("Unable to find file_location for #{name}")
  else
    @file_location = nil # not sure if this is actually needed
  end
end

Instance Method Details

#validated_partsObject



26
27
28
29
30
31
32
33
34
# File 'lib/kennel/models/project.rb', line 26

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