Class: DYI::Stylesheet::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/dyi/stylesheet.rb

Overview

Since:

  • 1.0.0

Direct Known Subclasses

StyleReference

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, content_type = 'text/css', options = {}) ⇒ Style

Returns a new instance of Style.

Parameters:

  • body (String)

    body of client scripting

  • content_type (String) (defaults to: 'text/css')

    content-type of script

Since:

  • 1.0.0



43
44
45
46
47
48
# File 'lib/dyi/stylesheet.rb', line 43

def initialize(body, content_type='text/css', options={})
  @content_type = content_type
  @body = body
  @media = options[:media]
  @title = options[:title]
end

Instance Attribute Details

#bodyString (readonly)

Returns body of client scripting.

Returns:

  • (String)

    body of client scripting

Since:

  • 1.0.0



38
39
40
# File 'lib/dyi/stylesheet.rb', line 38

def body
  @body
end

#content_typeString (readonly)

Returns content-type of script.

Returns:

  • (String)

    content-type of script

Since:

  • 1.0.0



36
37
38
# File 'lib/dyi/stylesheet.rb', line 36

def content_type
  @content_type
end

#mediaObject (readonly)

Since:

  • 1.0.0



39
40
41
# File 'lib/dyi/stylesheet.rb', line 39

def media
  @media
end

#titleObject (readonly)

Since:

  • 1.0.0



39
40
41
# File 'lib/dyi/stylesheet.rb', line 39

def title
  @title
end

Instance Method Details

#has_uri_reference?Boolean

Returns this script includes reference of external script file.

Returns:

  • (Boolean)

    always returns false

Since:

  • 1.0.0



56
57
58
# File 'lib/dyi/stylesheet.rb', line 56

def has_uri_reference?
  false
end

#include_external_file?Boolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



50
51
52
# File 'lib/dyi/stylesheet.rb', line 50

def include_external_file?
  false
end

#write_as(formatter, io = $>) ⇒ Object

Writes the buffer contents of the object.

Parameters:

  • a (Formatter::Base)

    formatter for export

  • io (IO) (defaults to: $>)

    a buffer that is written

Since:

  • 1.0.0



63
64
65
# File 'lib/dyi/stylesheet.rb', line 63

def write_as(formatter, io=$>)
  formatter.write_style(self, io)
end