Class: Language
Class Method Summary
collapse
Instance Method Summary
collapse
#platform_class_name
aggregate_of, all_except, defaults, #delete, #destroy!, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, #update_and_notify!, update_or_create!, whitelist_attributes
Class Method Details
.for_name(name) ⇒ Object
58
59
60
|
# File 'app/models/language.rb', line 58
def self.for_name(name)
find_by_ignore_case!(:name, name) if name
end
|
Instance Method Details
#assets_urls_for(kind, content_type) ⇒ Object
80
81
82
|
# File 'app/models/language.rb', line 80
def assets_urls_for(kind, content_type)
send "#{kind}_#{content_type}_urls"
end
|
#bridge ⇒ Object
42
43
44
|
# File 'app/models/language.rb', line 42
def bridge
Mumukit::Bridge::Runner.new(runner_url)
end
|
#devicon ⇒ Object
62
63
64
|
# File 'app/models/language.rb', line 62
def devicon
self[:devicon] || name.downcase
end
|
#directives_sections ⇒ Object
75
76
77
|
# File 'app/models/language.rb', line 75
def directives_sections
new_directive Mumukit::Directives::Sections
end
|
#highlight_mode ⇒ Object
46
47
48
|
# File 'app/models/language.rb', line 46
def highlight_mode
self[:highlight_mode] || name
end
|
#import_from_resource_h!(resource_h) ⇒ Object
70
71
72
73
|
# File 'app/models/language.rb', line 70
def import_from_resource_h!(resource_h)
assign_attributes resource_h.except(:runner_url)
save!
end
|
#interpolate_references_for(assignment, field) ⇒ Object
TODO this should be a Mumukit::Directives::Directive and be part of a pipeline
86
87
88
|
# File 'app/models/language.rb', line 86
def interpolate_references_for(assignment, field)
interpolate(field, assignment.submitter.interpolations, lambda { |content| replace_content_reference(assignment, content) })
end
|
#output_content_type ⇒ Object
50
51
52
|
# File 'app/models/language.rb', line 50
def output_content_type
Mumukit::ContentType.for(self[:output_content_type])
end
|
#sync_key ⇒ Object
66
67
68
|
# File 'app/models/language.rb', line 66
def sync_key
Mumukit::Sync.key :language, runner_url
end
|
#to_embedded_resource_h ⇒ Object
90
91
92
|
# File 'app/models/language.rb', line 90
def to_embedded_resource_h
as_json(only: [:name, :extension, :test_extension]).symbolize_keys
end
|
#to_s ⇒ Object
54
55
56
|
# File 'app/models/language.rb', line 54
def to_s
name
end
|