Class: RCL::Timestamp
Instance Attribute Summary collapse
-
#access ⇒ Object
readonly
Returns the value of attribute access.
-
#create ⇒ Object
readonly
Returns the value of attribute create.
-
#modify ⇒ Object
readonly
Returns the value of attribute modify.
Instance Method Summary collapse
- #dump(indent = 0, stream = STDOUT) ⇒ Object
-
#initialize ⇒ Timestamp
constructor
A new instance of Timestamp.
- #update ⇒ Object
- #update_access ⇒ Object
- #update_modify ⇒ Object
Constructor Details
#initialize ⇒ Timestamp
Returns a new instance of Timestamp.
10 11 12 13 14 15 16 |
# File 'lib/rcl/timestamp.rb', line 10 def initialize @create = Time.now @modify = nil @access = nil nil end |
Instance Attribute Details
#access ⇒ Object (readonly)
Returns the value of attribute access.
8 9 10 |
# File 'lib/rcl/timestamp.rb', line 8 def access @access end |
#create ⇒ Object (readonly)
Returns the value of attribute create.
8 9 10 |
# File 'lib/rcl/timestamp.rb', line 8 def create @create end |
#modify ⇒ Object (readonly)
Returns the value of attribute modify.
8 9 10 |
# File 'lib/rcl/timestamp.rb', line 8 def modify @modify end |
Instance Method Details
#dump(indent = 0, stream = STDOUT) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rcl/timestamp.rb', line 37 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 # create indent.times { stream << ' ' } stream << "create: #{@create}\n" # modify indent.times { stream << ' ' } stream << "modify: #{!@modify.nil? ? @modify : '<unset>'}\n" # access indent.times { stream << ' ' } stream << "access: #{!@access.nil? ? @access : '<unset>'}\n" nil end |
#update ⇒ Object
30 31 32 33 34 35 |
# File 'lib/rcl/timestamp.rb', line 30 def update update_modify update_access nil end |
#update_access ⇒ Object
24 25 26 27 28 |
# File 'lib/rcl/timestamp.rb', line 24 def update_access @access = Time.now nil end |
#update_modify ⇒ Object
18 19 20 21 22 |
# File 'lib/rcl/timestamp.rb', line 18 def update_modify @modify = Time.now nil end |