Class: Gonzui::ContentInfo
- Inherits:
-
Struct
- Object
- Struct
- Gonzui::ContentInfo
- Extended by:
- Util
- Defined in:
- lib/gonzui/info.rb,
lib/gonzui/info.rb
Constant Summary collapse
- PACK_FORMAT =
"w*"
Instance Attribute Summary collapse
-
#format_id ⇒ Object
Returns the value of attribute format_id.
-
#indexed_p ⇒ Object
Returns the value of attribute indexed_p.
-
#itime ⇒ Object
Returns the value of attribute itime.
-
#license_id ⇒ Object
Returns the value of attribute license_id.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#nlines ⇒ Object
Returns the value of attribute nlines.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Util
assert, assert_equal, assert_equal_all, assert_non_nil, assert_not_reached, benchmark, command_exist?, commify, eprintf, format_bytes, program_name, protect_from_signals, require_command, set_verbosity, shell_escape, unix?, vprintf, windows?, wprintf
Instance Attribute Details
#format_id ⇒ Object
Returns the value of attribute format_id
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def format_id @format_id end |
#indexed_p ⇒ Object
Returns the value of attribute indexed_p
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def indexed_p @indexed_p end |
#itime ⇒ Object
Returns the value of attribute itime
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def itime @itime end |
#license_id ⇒ Object
Returns the value of attribute license_id
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def license_id @license_id end |
#mtime ⇒ Object
Returns the value of attribute mtime
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def mtime @mtime end |
#nlines ⇒ Object
Returns the value of attribute nlines
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def nlines @nlines end |
#size ⇒ Object
Returns the value of attribute size
46 47 48 |
# File 'lib/gonzui/info.rb', line 46 def size @size end |
Class Method Details
.dump(size, mtime, itime, format_id, license_id, nlines, indexed_p) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gonzui/info.rb', line 59 def self.dump(size, mtime, itime, format_id, license_id, nlines, indexed_p) indexed_p = if indexed_p then 1 else 0 end # FIXME: It could happen for some cases. if mtime < 0 vprintf("minus mtime found: %d", mtime) mtime = Time.now.to_i end [size, mtime, itime, format_id, license_id, nlines, indexed_p].pack(PACK_FORMAT) end |
.load(dump) ⇒ Object
53 54 55 56 57 |
# File 'lib/gonzui/info.rb', line 53 def self.load(dump) info = self.new(*dump.unpack(PACK_FORMAT)) info.indexed_p = if info.indexed_p == 1 then true else false end return info end |
Instance Method Details
#indexed? ⇒ Boolean
71 72 73 |
# File 'lib/gonzui/info.rb', line 71 def indexed? self.indexed_p end |