Sha256: 106e7dc3c5eb1fa5b35e40e9a816b434ddd5d9f583a60175afabf5a809fd13da

Contents?: true

Size: 439 Bytes

Versions: 7

Compression:

Stored size: 439 Bytes

Contents

module HaveAPI::Fs::Components
  class UnsavedList < File
    def read
      str = list_unsaved.join("\n")
      str += "\n" unless str.empty?
      str
    end

    protected
    def list_unsaved(component = nil)
      component ||= parent
      ret = []

      component.send(:children).each do |_, c|
        next unless c.unsaved?

        ret << c.path
        ret.concat(list_unsaved(c))
      end
      
      ret
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
haveapi-fs-0.11.0 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.10.0 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.9.0 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.8.0 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.7.1 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.7.0 lib/haveapi/fs/components/unsaved_list.rb
haveapi-fs-0.1.0 lib/haveapi/fs/components/unsaved_list.rb