Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/glimmer-dsl-opal/ext/file.rb
Constant Summary collapse
- REGEXP_DIR_FILE =
/\(dir\)|\(file\)/
Class Attribute Summary collapse
-
.image_paths ⇒ Object
Returns the value of attribute image_paths.
Class Method Summary collapse
- .expand_path(path, base = nil) ⇒ Object
-
.expand_path_without_glimmer ⇒ Object
Include special processing for images that matches them against a list of available image paths from the server to convert to web paths.
- .get_image_paths ⇒ Object
- .read(*args, &block) ⇒ Object
Class Attribute Details
.image_paths ⇒ Object
Returns the value of attribute image_paths.
28 29 30 |
# File 'lib/glimmer-dsl-opal/ext/file.rb', line 28 def image_paths @image_paths end |
Class Method Details
.expand_path(path, base = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/glimmer-dsl-opal/ext/file.rb', line 38 def (path, base=nil) get_image_paths unless image_paths path = (path, base) if base path_include_dir_or_file = !!path.match(REGEXP_DIR_FILE) essential_path = path.split('(dir)').last.split('(file)').last.split('../').last.split('./').last image_paths.detect do |image_path| image_path.include?(essential_path) end end |
.expand_path_without_glimmer ⇒ Object
Include special processing for images that matches them against a list of available image paths from the server to convert to web paths.
37 |
# File 'lib/glimmer-dsl-opal/ext/file.rb', line 37 alias |
.get_image_paths ⇒ Object
48 49 50 51 |
# File 'lib/glimmer-dsl-opal/ext/file.rb', line 48 def get_image_paths image_paths_json = Net::HTTP.get(`window.location.origin`, "/glimmer/image_paths.json") self.image_paths = JSON.parse(image_paths_json) end |
.read(*args, &block) ⇒ Object
30 31 32 33 |
# File 'lib/glimmer-dsl-opal/ext/file.rb', line 30 def read(*args, &block) # TODO implement via asset downloads in the future # No Op in Opal end |