lib/aef/hosts/empty_element.rb
# encoding: UTF-8
=begin
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
This file is part of Hosts.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
=end
require 'aef/hosts'
module Aef
module Hosts
# Represents an empty line as element of a hosts file
class EmptyElement < Element
# Initializes an empty Element
#
# @param [Hash] options
# @option options [String] :cache sets a cached String representation
def initialize(options = {})
validate_options(options, :cache)
@cache = options[:cache].to_s unless options[:cache].nil?
end
protected
# Defines the algorithm to generate a String representation from scratch.
#
# @return [String] a generated String representation
def generate_string(options = {})
"\n"
end
end
end
end