Class: Alf::Rest::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/alf/rest/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, heading) ⇒ Request

Returns a new instance of Request.



5
6
7
8
# File 'lib/alf/rest/request.rb', line 5

def initialize(env, heading)
  super(env)
  @heading  = Heading.coerce(heading)
end

Instance Attribute Details

#headingObject (readonly)

Returns the value of attribute heading.



9
10
11
# File 'lib/alf/rest/request.rb', line 9

def heading
  @heading
end

Instance Method Details

#to_relationObject



11
12
13
14
15
# File 'lib/alf/rest/request.rb', line 11

def to_relation
  relation = Relation.coerce(each.to_a)
  commons  = heading.to_attr_list & relation.heading.to_attr_list
  relation.project(commons).coerce(heading.project(commons))
end

#to_tupleObject



17
18
19
# File 'lib/alf/rest/request.rb', line 17

def to_tuple
  to_relation.tuple_extract
end