Sha256: e56e04ac879839d3fb40a95bfbdf3e025fb101bc9fc04576410eed2d93317500

Contents?: true

Size: 438 Bytes

Versions: 9

Compression:

Stored size: 438 Bytes

Contents

module Bunch
  class FileNode < AbstractNode
    attr_accessor :name, :target_extension

    def initialize(fn)
      @filename = fn

      if fn =~ /\.[^.]*$/
        @name = File.basename($`)
        @target_extension = $&
      else
        @name = File.basename(@filename)
        @target_extension = nil
      end
    end

    def content
      File.read(@filename)
    end

    def inspect
      @filename.inspect
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bunch-0.2.2 lib/bunch/file_node.rb
bunch-0.2.1 lib/bunch/file_node.rb
bunch-0.2.0 lib/bunch/file_node.rb
bunch-0.1.0 lib/bunch/file_node.rb
bunch-0.0.11 lib/bunch/file_node.rb
bunch-0.0.10 lib/bunch/file_node.rb
bunch-0.0.9 lib/bunch/file_node.rb
bunch-0.0.8 lib/bunch/file_node.rb
bunch-0.0.7 lib/bunch/file_node.rb