Class: Wakame::Service::Resource
Constant Summary
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Class Method Summary
collapse
Instance Method Summary
collapse
#delete, #dirty?, #new_record?, #on_after_delete, #on_after_load, #on_before_delete, #on_before_load, #save
#dump_attrs, #retrieve_attr_attribute
Class Method Details
permalink
.id(name = nil) ⇒ Object
Returns the hashed resource class name representation.
Resource.id() is as same as sha1.digest('Wakame::Service::Resource')
With an argument, tries to get the class name and take digest.
[View source]
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
|
# File 'lib/wakame/service.rb', line 1077
def self.id(name=nil)
res_class_name = case name
when nil
self.to_s
when String
raise "Invalid string as ruby constant: #{name}" unless name =~ /^(:-\:\:)?[A-Z]/
name.to_s
when Class
raise "Can't convert the argument: type of #{name.class}" unless name <= self
name.to_s
when Resource
name.class.to_s
else
raise "Can't convert the argument: type of #{name.class}"
end
require 'digest/sha1'
Digest::SHA1.hexdigest(res_class_name)
end
|
permalink
.inherited(klass) ⇒ Object
[View source]
1062
1063
1064
1065
1066
1067
1068
|
# File 'lib/wakame/service.rb', line 1062
def self.inherited(klass)
klass.class_eval {
def self.id
Resource.id(self)
end
}
end
|
permalink
.name(id) ⇒ Object
[View source]
1070
1071
1072
|
# File 'lib/wakame/service.rb', line 1070
def self.name(id)
find(id).class.to_s
end
|
Instance Method Details
[View source]
1097
1098
1099
|
# File 'lib/wakame/service.rb', line 1097
def id
Resource.id(self.class.to_s)
end
|
permalink
#on_child_changed(service_instance, action) ⇒ Object
[View source]
1112
1113
|
# File 'lib/wakame/service.rb', line 1112
def on_child_changed(service_instance, action)
end
|
permalink
#on_enter_agent(service_instance, action) ⇒ Object
[View source]
1117
1118
|
# File 'lib/wakame/service.rb', line 1117
def on_enter_agent(service_instance, action)
end
|
permalink
#on_parent_changed(service_instance, action) ⇒ Object
[View source]
1114
1115
|
# File 'lib/wakame/service.rb', line 1114
def on_parent_changed(service_instance, action)
end
|
permalink
#on_quit_agent(service_instance, action) ⇒ Object
[View source]
1119
1120
|
# File 'lib/wakame/service.rb', line 1119
def on_quit_agent(service_instance, action)
end
|
permalink
#reload(service_instance, action) ⇒ Object
[View source]
1107
|
# File 'lib/wakame/service.rb', line 1107
def reload(service_instance, action); end
|
permalink
#render_config(template) ⇒ Object
[View source]
1109
1110
|
# File 'lib/wakame/service.rb', line 1109
def render_config(template)
end
|
permalink
#start(service_instance, action) ⇒ Object
[View source]
1105
|
# File 'lib/wakame/service.rb', line 1105
def start(service_instance, action); end
|
permalink
#stop(service_instance, action) ⇒ Object
[View source]
1106
|
# File 'lib/wakame/service.rb', line 1106
def stop(service_instance, action); end
|