class Linguist::LazyBlob

def boolean_attribute(attribute)

Returns true if the attribute is present and not the string "false" and not the false boolean.
def boolean_attribute(attribute)
  attribute != "false" && attribute != false
end

def cleanup!

def cleanup!
  @data.clear if @data
end

def data

def data
  load_blob!
  @data
end

def detectable?

def detectable?
  if not git_attributes['linguist-detectable'].nil?
    boolean_attribute(git_attributes['linguist-detectable'])
  else
    nil
  end
end

def documentation?

def documentation?
  if not git_attributes['linguist-documentation'].nil?
    boolean_attribute(git_attributes['linguist-documentation'])
  else
    super
  end
end

def generated?

def generated?
  if not git_attributes['linguist-generated'].nil?
    boolean_attribute(git_attributes['linguist-generated'])
  else
    super
  end
end

def git_attributes

def git_attributes
  @git_attributes ||= repository.load_attributes_for_path(name, GIT_ATTR)
end

def initialize(repo, oid, path, mode = nil)

def initialize(repo, oid, path, mode = nil)
  @repository = if repo.is_a? Linguist::Source::Repository
    repo
  else
    # Allow this for backward-compatibility purposes
    Linguist::Source::RuggedRepository.new(repo)
  end
  @oid = oid
  @path = path
  @mode = mode
  @data = nil
end

def language

def language
  return @language if defined?(@language)
  @language = if lang = git_attributes['linguist-language']
    Language.find_by_alias(lang)
  else
    super
  end
end

def load_blob!

def load_blob!
  @data, @size = repository.load_blob(oid, MAX_SIZE) if @data.nil?
end

def size

def size
  load_blob!
  @size
end

def symlink?

def symlink?
  # We don't create LazyBlobs for symlinks.
  false
end

def vendored?

def vendored?
  if not git_attributes['linguist-vendored'].nil?
    boolean_attribute(git_attributes['linguist-vendored'])
  else
    super
  end
end