Class: RCL::Base

Inherits:
Object show all
Defined in:
lib/rcl/base.rb

Direct Known Subclasses

Shell

Instance Method Summary collapse

Constructor Details

#initializeBase

initialize instance



9
10
11
12
13
# File 'lib/rcl/base.rb', line 9

def initialize
  @timestamp = Timestamp.new

  nil
end

Instance Method Details

#accessObject

return access time



31
32
33
# File 'lib/rcl/base.rb', line 31

def access
  @timestamp.access
end

#createObject

return creation time



16
17
18
# File 'lib/rcl/base.rb', line 16

def create
  @timestamp.create
end

#dump(indent = 0, stream = STDOUT) ⇒ Object

dump instance state to specified output stream

Raises:

  • (ArgumentError)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rcl/base.rb', line 41

def dump(indent=0, stream=STDOUT)
  raise ArgumentError, 'nil indent' if indent.nil?
  raise ArgumentError, 'invalid indent class' if indent.class != Fixnum
  raise ArgumentError, 'indent range error' if indent < 0
  raise ArgumentError, 'nil stream' if stream.nil?
  raise ArgumentError, 'invalid stream class' if stream.class != IO

  # instance
  indent.times { stream << ' ' }
  stream << "#{self.class}<#{self.object_id}> instance:\n"

  indent += 2

  # @timestamp
  @timestamp.dump(indent, stream)

  nil
end

#modifyObject

return modification time



21
22
23
# File 'lib/rcl/base.rb', line 21

def modify
  @timestamp.modify
end

#update_accessObject

update access time



36
37
38
# File 'lib/rcl/base.rb', line 36

def update_access
  @timestamp.update_access
end

#update_modifyObject

update modification time



26
27
28
# File 'lib/rcl/base.rb', line 26

def update_modify
  @timestamp.update_modify
end