class Rack::DevMark::Theme::Base
Public Class Methods
new(options = {})
click to toggle source
# File lib/rack/dev-mark/theme/base.rb, line 5 def initialize(options = {}) raise RuntimeError, 'Abstract class can not be instantiated' if self.class == Rack::DevMark::Theme::Base @options = options end
Public Instance Methods
insert_into(html, env, params = {})
click to toggle source
# File lib/rack/dev-mark/theme/base.rb, line 10 def insert_into(html, env, params = {}) end
Private Instance Methods
gsub_tag_attribute(html, name, attr, &block)
click to toggle source
# File lib/rack/dev-mark/theme/base.rb, line 26 def gsub_tag_attribute(html, name, attr, &block) String.new(html).gsub %r{(<#{name}\s*)([^>]*)(>)}im do s1, s2, s3 = $1, $2, $3 s2.gsub! %r{(#{attr}=')([^']*)(')} do "#{$1}#{block.call($2)}#{$3}" end s2.gsub! %r{(#{attr}=")([^"]*)(")} do "#{$1}#{block.call($2)}#{$3}" end "#{s1}#{s2}#{s3}" end end
gsub_tag_content(html, name, &block)
click to toggle source
# File lib/rack/dev-mark/theme/base.rb, line 20 def gsub_tag_content(html, name, &block) String.new(html).gsub(%r{(<#{name}\s*[^>]*>)([^<]*)(</#{name}>)}im) do "#{$1}#{block.call($2)}#{$3}" end end
stylesheet_link_tag(path)
click to toggle source
# File lib/rack/dev-mark/theme/base.rb, line 16 def stylesheet_link_tag(path) %Q~<style>#{::File.open(::File.join(::File.dirname(__FILE__), '../../../../vendor/assets/stylesheets', path)).read}</style>~ end