Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
7f6e4abb
Commit
7f6e4abb
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Patches
Plain Diff
creating attachment builder
parent
f8d47890
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/builders/learning_object/attachment_builder.rb
+30
-0
30 additions, 0 deletions
app/builders/learning_object/attachment_builder.rb
app/models/learning_object/attachment.rb
+2
-0
2 additions, 0 deletions
app/models/learning_object/attachment.rb
with
32 additions
and
0 deletions
app/builders/learning_object/attachment_builder.rb
0 → 100644
+
30
−
0
View file @
7f6e4abb
module
LearningObject
class
AttachmentBuilder
<
::
Builder
##disable method
# build attachments with id's is out of scope.
def
self
.
build
(
objects
=
[])
raise
NotImplementedError
,
'LearningObject::AttachmentBuilder#build is out of scope.'
end
def
self
.
build_from_orientdb
(
args
=
{})
build_from_cache
args
do
::
LearningObject
::
Attachment
.
new
(
args
)
end
end
private
def
self
.
build_from_cache
(
args
=
{})
object
=
nil
unless
args
.
nil?
||
!
block_given?
# cache object when build
object
=
Rails
.
cache
.
fetch
(
cache_key
(
args
[
'id'
],
args
[
'link'
]),
expires_in:
12
.
hours
)
{
yield
}
end
object
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/models/learning_object/attachment.rb
+
2
−
0
View file @
7f6e4abb
class
LearningObject::Attachment
include
ActiveModel
::
Model
#this attributes mirror Dspace bitstream values
attr_accessor
:id
,
:name
,
:link
,
:retrieve_link
,
:description
,
:format
,
:mime_type
,
:size
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment