Sha256: a2a277c862410233b18320ce4f5c0cb7a45a7b13cd094c51ed4980ea54dd2920

Contents?: true

Size: 394 Bytes

Versions: 3

Compression:

Stored size: 394 Bytes

Contents

module Bunch
  class FileNode
    attr_reader :name, :target_extension

    def initialize(fn)
      @filename = fn

      if fn =~ %r(\.([^.]*)$)
        @name = File.basename($`)
        @target_extension = $1
      else
        @name = File.basename(@filename)
      end
    end

    def contents
      File.read(@filename)
    end

    def inspect
      @filename.inspect
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bunch-0.0.4 lib/bunch/file_node.rb
bunch-0.0.3 lib/bunch/file_node.rb
bunch-0.0.2 lib/bunch/file_node.rb