Sha256: a994f43ebf96a9d1d17d0aaacd9a6da972b7035418dbec6eceb9ad78b22917e5
Contents?: true
Size: 742 Bytes
Versions: 1
Compression:
Stored size: 742 Bytes
Contents
require 'time' module SMB module ClientHelper class LsItem REGEX = /(?<name>[\.|\w]+)\s+(?<type>.)\s+(?<size>\d+)\s+(?<change_time>.+)/ attr_accessor :name, :type, :size, :change_time def file? %w[A N].include? @type end def directory? %w[D].include? @type end def hidden? %w[H].include? @type end def self.from_line(line) match_data = REGEX.match line return nil unless match_data item = LsItem.new item.name = match_data['name'] item.type = match_data['type'] item.size = match_data['size'].to_i item.change_time = Time.parse match_data['change_time'] item end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smb-client-0.1.6 | lib/smb/client/ls_item.rb |