Class: ROM::Files::Relation
- Inherits:
-
Relation
- Object
- Relation
- ROM::Files::Relation
show all
- Extended by:
- Forwardable
- Includes:
- Enumerable, ROM::Files
- Defined in:
- lib/rom/files/relation.rb
Constant Summary
Constants included
from ROM::Files
ALL, DATA, HERE, ID, RECURSIVE_EXPRESSION, RECURSIVE_PATTERN, VERSION
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
21
22
23
24
|
# File 'lib/rom/files/relation.rb', line 21
def initialize(*) super
@dataset = @dataset.with(row_proc: schema.row_proc) if schema
end
|
Instance Attribute Details
|
# File 'lib/rom/files/relation.rb', line 26
|
|
# File 'lib/rom/files/relation.rb', line 26
|
Instance Method Details
#contents_for(tuple) ⇒ Object
140
|
# File 'lib/rom/files/relation.rb', line 140
def_instance_delegators :schema, :identify, :contents_for
|
#count ⇒ Integer
106
107
108
|
# File 'lib/rom/files/relation.rb', line 106
def count
dataset.count
end
|
#create(tuple) ⇒ Object
Also known as:
<<
112
113
114
115
116
117
|
# File 'lib/rom/files/relation.rb', line 112
def create(tuple)
dataset.write(
identify(tuple),
contents_for(tuple)
)
end
|
#delete(tuple) ⇒ Object
127
128
129
|
# File 'lib/rom/files/relation.rb', line 127
def delete(tuple)
dataset.delete(identify(tuple))
end
|
#identify(tuple) ⇒ Object
140
|
# File 'lib/rom/files/relation.rb', line 140
def_instance_delegators :schema, :identify, :contents_for
|
#inside(*prefixes) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#mime_type ⇒ MIME::Type?
84
|
# File 'lib/rom/files/relation.rb', line 84
def_instance_delegators :dataset, :mime_type, :recursive?, :pluck
|
#pluck ⇒ Array
84
|
# File 'lib/rom/files/relation.rb', line 84
def_instance_delegators :dataset, :mime_type, :recursive?, :pluck
|
#project(*names) ⇒ Relation
Project a relation with provided attribute names
93
94
95
|
# File 'lib/rom/files/relation.rb', line 93
def project(*names)
schema.project(*names).(self)
end
|
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#recursive? ⇒ Boolean
84
|
# File 'lib/rom/files/relation.rb', line 84
def_instance_delegators :dataset, :mime_type, :recursive?, :pluck
|
#reject(*patterns) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#reject_append(*patterns) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#restrict(criteria = nil) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#select(*patterns) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#select_append(*patterns) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#sort(sorting = :to_s) ⇒ Relation
67
68
|
# File 'lib/rom/files/relation.rb', line 67
forward :select, :select_append, :reject, :reject_append,
:inside, :recursive, :sort, :restrict, :join
|
#update(tuple, attributes = {}) ⇒ Object
120
121
122
123
124
125
|
# File 'lib/rom/files/relation.rb', line 120
def update(tuple, attributes = {})
dataset.write(
identify(tuple),
contents_for(tuple.merge(attributes))
)
end
|