module Vue::Helpers::CoreRefinements
Public Instance Methods
breadth_first(pattern, flags=0, base: Dir.getwd, **opts) { |f| ... }
click to toggle source
Args are like Dir.glob() with **opts accaptable.
Returns list of files breadth-first. Pass :no_recurse=>true to block directory recursion. Pass a block to yield each found path to the block.
# File lib/vue/helpers/utilities.rb, line 39 def breadth_first(pattern, flags=0, base: Dir.getwd, **opts, &block) files, dirs = [], [] Dir.glob(File.join(base, pattern), flags).each{|path| FileTest.directory?(path) ? dirs.push(path) : files.push(path)} files.each{|f| yield(f)} if block_given? dirs.each{|dir| files.concat(breadth_first(pattern, flags, base:dir, &block))} unless opts[:no_recurse] files end
camelize()
click to toggle source
# File lib/vue/helpers/utilities.rb, line 12 def camelize #split(/[_-]/).collect(&:capitalize).join split(/\W|_/).collect(&:capitalize).join end
escape_backticks()
click to toggle source
# File lib/vue/helpers/utilities.rb, line 21 def escape_backticks gsub(/\`/,'\\\`') end
interpolate(**locals)
click to toggle source
# File lib/vue/helpers/utilities.rb, line 8 def interpolate(**locals) gsub(/\#\{/, '%{') % locals end
kebabize()
click to toggle source
# File lib/vue/helpers/utilities.rb, line 17 def kebabize split(/\W|_/).collect(&:downcase).join('-') end
to_html_attributes()
click to toggle source
# File lib/vue/helpers/utilities.rb, line 27 def to_html_attributes inject(''){|o, kv| o.to_s << %Q(#{kv[0]}="#{kv[1]}")} end