class Sinatra::Schema::DSL::Links
Attributes
href[RW]
link[RW]
method[RW]
resource[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 7 def initialize(options) @href = options.fetch(:href) @method = options.fetch(:method) @resource = options.fetch(:resource) @link = build_link end
Public Instance Methods
action(&blk)
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 26 def action(&blk) link.action_block = blk end
description(description)
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 22 def description(description) link.description = description end
property()
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 30 def property DSL::Definitions.new(resource, [resource.defs, link.properties]) end
rel(rel)
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 18 def rel(rel) link.rel = rel.to_sym end
title(title)
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 14 def title(title) link.title = title end
Protected Instance Methods
build_link()
click to toggle source
# File lib/sinatra/schema/dsl/links.rb, line 36 def build_link full_href = "#{resource.path}/#{href}".gsub("//", "/").chomp("/") Link.new(resource: resource, method: method, href: full_href) end