Class: Sinatra::Schema::DSL::Links
- Inherits:
-
Object
- Object
- Sinatra::Schema::DSL::Links
- Defined in:
- lib/sinatra/schema/dsl/links.rb
Instance Attribute Summary collapse
-
#href ⇒ Object
Returns the value of attribute href.
-
#link ⇒ Object
Returns the value of attribute link.
-
#method ⇒ Object
Returns the value of attribute method.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #action(&blk) ⇒ Object
- #description(description) ⇒ Object
-
#initialize(options) ⇒ Links
constructor
A new instance of Links.
- #property ⇒ Object
- #rel(rel) ⇒ Object
- #title(title) ⇒ Object
Constructor Details
#initialize(options) ⇒ Links
Returns a new instance of Links.
7 8 9 10 11 12 |
# File 'lib/sinatra/schema/dsl/links.rb', line 7 def initialize() @href = .fetch(:href) @method = .fetch(:method) @resource = .fetch(:resource) @link = build_link end |
Instance Attribute Details
#href ⇒ Object
Returns the value of attribute href.
5 6 7 |
# File 'lib/sinatra/schema/dsl/links.rb', line 5 def href @href end |
#link ⇒ Object
Returns the value of attribute link.
5 6 7 |
# File 'lib/sinatra/schema/dsl/links.rb', line 5 def link @link end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/sinatra/schema/dsl/links.rb', line 5 def method @method end |
#resource ⇒ Object
Returns the value of attribute resource.
5 6 7 |
# File 'lib/sinatra/schema/dsl/links.rb', line 5 def resource @resource end |
Instance Method Details
#action(&blk) ⇒ Object
26 27 28 |
# File 'lib/sinatra/schema/dsl/links.rb', line 26 def action(&blk) link.action_block = blk end |
#description(description) ⇒ Object
22 23 24 |
# File 'lib/sinatra/schema/dsl/links.rb', line 22 def description(description) link.description = description end |
#property ⇒ Object
30 31 32 |
# File 'lib/sinatra/schema/dsl/links.rb', line 30 def property DSL::Definitions.new(resource, [resource.defs, link.properties]) end |
#rel(rel) ⇒ Object
18 19 20 |
# File 'lib/sinatra/schema/dsl/links.rb', line 18 def rel(rel) link.rel = rel.to_sym end |
#title(title) ⇒ Object
14 15 16 |
# File 'lib/sinatra/schema/dsl/links.rb', line 14 def title(title) link.title = title end |