class File
Constants
- REGEXP_DIR_FILE
Attributes
image_paths[RW]
Public Class Methods
expand_path(path, base=nil)
click to toggle source
# File lib/glimmer-dsl-opal/ext/file.rb, line 38 def expand_path(path, base=nil) get_image_paths unless image_paths path = expand_path_without_glimmer(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
Also aliased as: expand_path_without_glimmer
expand_path_without_glimmer(path, base=nil)
Include special processing for images that matches them against a list of available image paths from the server to convert to web paths.
Alias for: expand_path
get_image_paths()
click to toggle source
# 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)
click to toggle source
# 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