class Webspicy::Resource
Attributes
config[RW]
location[R]
Public Class Methods
new(raw, location = nil)
click to toggle source
Calls superclass method
Webspicy::Support::DataObject::new
# File lib/webspicy/specification.rb, line 5 def initialize(raw, location = nil) super(raw) @location = location bind_services end
Public Instance Methods
locate(relative_path)
click to toggle source
# File lib/webspicy/specification.rb, line 21 def locate(relative_path) file = @location.parent/relative_path raise "File not found: #{file}" unless file.exists? file end
located_at!(location)
click to toggle source
# File lib/webspicy/specification.rb, line 13 def located_at!(location) @location = Path(location) end
name()
click to toggle source
# File lib/webspicy/specification.rb, line 27 def name @raw[:name] || relative_location || "Unnamed" end
relative_location()
click to toggle source
# File lib/webspicy/specification.rb, line 17 def relative_location @location && @location.relative_to(config.folder) end
services()
click to toggle source
# File lib/webspicy/specification.rb, line 31 def services @raw[:services] || [] end
Private Instance Methods
bind_services()
click to toggle source
# File lib/webspicy/specification.rb, line 37 def bind_services services.each do |s| s.specification = self end end