Class: Spotlight::MDItem
- Inherits:
-
Object
show all
- Defined in:
- lib/spotlight.rb
Defined Under Namespace
Classes: InvalidAttributeValueTypeError
Constant Summary
collapse
- VALID_ATTRIBUTE_VALUE_TYPE =
[String, Time, Fixnum, Bignum, Float, Array, NilClass]
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path) ⇒ MDItem
Returns a new instance of MDItem.
17
18
19
|
# File 'lib/spotlight.rb', line 17
def initialize(path)
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
16
17
18
|
# File 'lib/spotlight.rb', line 16
def path
@path
end
|
Instance Method Details
#==(obj) ⇒ Object
36
37
38
|
# File 'lib/spotlight.rb', line 36
def ==(obj)
obj.is_a?(MDItem) && @path == obj.path
end
|
#[](attr_name) ⇒ Object
26
27
28
|
# File 'lib/spotlight.rb', line 26
def [](attr_name)
Intern.get_attribute(@path, attr_name)
end
|
#[]=(attr_name, attr_value) ⇒ Object
29
30
31
32
|
# File 'lib/spotlight.rb', line 29
def []=(attr_name, attr_value)
validate(attr_value)
Intern.set_attribute(@path, attr_name, attr_value)
end
|
#attributes ⇒ Object
20
21
22
|
# File 'lib/spotlight.rb', line 20
def attributes
Intern.attributes(@path)
end
|
#attributes=(attributes) ⇒ Object
23
24
25
|
# File 'lib/spotlight.rb', line 23
def attributes=(attributes)
Intern.set_attributes(@path, attributes)
end
|
#reload ⇒ Object
33
34
35
|
# File 'lib/spotlight.rb', line 33
def reload
self
end
|
#validate(value) ⇒ Object