Class: CSSPool::CSS::ImportRule

Inherits:
Node
  • Object
show all
Defined in:
lib/csspool/css/import_rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #children, #each, #hash, #to_css, #to_minified_css

Constructor Details

#initialize(uri, namespace, media, document, parse_location) ⇒ ImportRule

Returns a new instance of ImportRule.



10
11
12
13
14
15
16
# File 'lib/csspool/css/import_rule.rb', line 10

def initialize uri, namespace, media, document, parse_location
  @uri = uri
  @namespace = namespace
  @media = media
  @document = document
  @parse_location = parse_location
end

Instance Attribute Details

#documentObject

Returns the value of attribute document.



7
8
9
# File 'lib/csspool/css/import_rule.rb', line 7

def document
  @document
end

#mediaObject

Returns the value of attribute media.



6
7
8
# File 'lib/csspool/css/import_rule.rb', line 6

def media
  @media
end

#namespaceObject

Returns the value of attribute namespace.



5
6
7
# File 'lib/csspool/css/import_rule.rb', line 5

def namespace
  @namespace
end

#parse_locationObject

Returns the value of attribute parse_location.



8
9
10
# File 'lib/csspool/css/import_rule.rb', line 8

def parse_location
  @parse_location
end

#uriObject

Returns the value of attribute uri.



4
5
6
# File 'lib/csspool/css/import_rule.rb', line 4

def uri
  @uri
end

Instance Method Details

#loadObject



18
19
20
21
22
23
24
# File 'lib/csspool/css/import_rule.rb', line 18

def load
  new_doc = CSSPool.CSS(yield uri.value)
  new_doc.parent_import_rule = self
  new_doc.parent = document
  new_doc.rule_sets.each { |rs| rs.media = media }
  new_doc
end