Class: ActiveCMIS::AtomicType::DateTime

Inherits:
CommonBase
  • Object
show all
Defined in:
lib/active_cmis/atomic_types.rb

Constant Summary collapse

YEAR =
"year"
DATE =
"date"
TIME =
"time"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommonBase

#cmis2rb, #rb2cmis

Constructor Details

#initialize(resolution) ⇒ DateTime

Returns a new instance of DateTime.



118
119
120
# File 'lib/active_cmis/atomic_types.rb', line 118

def initialize(resolution)
  @resolution = resolution
end

Instance Attribute Details

#resolutionObject (readonly)

Returns the value of attribute resolution.



106
107
108
# File 'lib/active_cmis/atomic_types.rb', line 106

def resolution
  @resolution
end

Class Method Details

.new(precision = TIME) ⇒ Object

Raises:

  • (ArgumentError)


109
110
111
112
# File 'lib/active_cmis/atomic_types.rb', line 109

def self.new(precision = TIME)
  raise ArgumentError.new("Got precision = #{precision.inspect}") unless [YEAR, DATE, TIME].include? precision.to_s.downcase
  @instances[precision] ||= super
end

Instance Method Details

#can_handle?(value) ⇒ Boolean

Returns:



135
136
137
# File 'lib/active_cmis/atomic_types.rb', line 135

def can_handle?(value)
  value.respond_to?(:strftime)
end

#to_sObject



114
115
116
# File 'lib/active_cmis/atomic_types.rb', line 114

def to_s
  "DateTime"
end