Class: StyleSheet
- Inherits:
-
Object
- Object
- StyleSheet
- Defined in:
- lib/hubdown/style_sheet.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/hubdown/style_sheet.rb', line 6 def content @content end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/hubdown/style_sheet.rb', line 4 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/hubdown/style_sheet.rb', line 5 def url @url end |
Instance Method Details
#download_content ⇒ Object
21 22 23 |
# File 'lib/hubdown/style_sheet.rb', line 21 def download_content @content ||= open("#{@url}/#{name}").read end |
#from_tag(tag) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/hubdown/style_sheet.rb', line 9 def from_tag tag matcher = /href=['|"](([\w:.\/])*)\/([\w|-]+.css)/.match( tag.to_s ) if matcher @url = matcher.captures[0] @name = matcher.captures[2] end end |
#to_tag ⇒ Object
17 18 19 |
# File 'lib/hubdown/style_sheet.rb', line 17 def to_tag "<link href=\"#{url}/#{name}\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\">" end |