Class: Less::Loader::Buffer
- Inherits:
-
Object
- Object
- Less::Loader::Buffer
- Defined in:
- lib/less/loader.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data, encoding = nil) ⇒ Buffer
constructor
A new instance of Buffer.
- #length ⇒ Object
- #toString(encoding = nil, begPos = 0, endPos = length) ⇒ Object
Constructor Details
#initialize(data, encoding = nil) ⇒ Buffer
Returns a new instance of Buffer.
108 109 110 111 112 113 |
# File 'lib/less/loader.rb', line 108 def initialize(data, encoding = nil) unless data.is_a? String data = data.to_ruby end @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
106 107 108 |
# File 'lib/less/loader.rb', line 106 def data @data end |
Instance Method Details
#length ⇒ Object
115 116 117 |
# File 'lib/less/loader.rb', line 115 def length @data.length end |
#toString(encoding = nil, begPos = 0, endPos = length) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/less/loader.rb', line 119 def toString(encoding = nil, begPos = 0, endPos = length) data = @data[ begPos..endPos ] if encoding == 'base64' data = Base64.encode64(data) data.delete!("\n"); data else # encoding == 'binary' data end end |