Skip to content

Commit

Permalink
hold property and method names in underscored format instead camelized
Browse files Browse the repository at this point in the history
  • Loading branch information
ptzn committed Jul 15, 2008
1 parent bbf4f6f commit 10bd58f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/callable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def intersys_methods
end

def intersys_method_names
@method_names ||= intersys_methods.map { |method| method.intersys_get('Name') }
@method_names ||= intersys_methods.map { |method| method.intersys_get('Name').underscore }
end

# returns list of properties for current class
Expand All @@ -23,7 +23,7 @@ def intersys_properties

def intersys_property_names
property_names = Intersys::Object.common_get_or_set('@property_names', {})
property_names[class_name] ||= intersys_properties.map { |prop| prop.intersys_get('Name') }
property_names[class_name] ||= intersys_properties.map { |prop| prop.intersys_get('Name').underscore }
end

def intersys_relations
Expand All @@ -33,7 +33,7 @@ def intersys_relations

def intersys_relation_names
relation_names = Intersys::Object.common_get_or_set('@relation_names', {})
relation_names[class_name] ||= intersys_relations.map { |prop| prop.intersys_get('Name') }
relation_names[class_name] ||= intersys_relations.map { |prop| prop.intersys_get('Name').underscore }
end

def intersys_attributes
Expand All @@ -43,7 +43,7 @@ def intersys_attributes

def intersys_attribute_names
attribute_names = Intersys::Object.common_get_or_set('@attribute_names', {})
attribute_names[class_name] ||= intersys_attributes.map { |prop| prop.intersys_get('Name') }
attribute_names[class_name] ||= intersys_attributes.map { |prop| prop.intersys_get('Name').underscore }
end

#protected
Expand All @@ -67,11 +67,11 @@ def intersys_call(method_name, *args)
alias :call :intersys_call

def intersys_has_property?(property)
intersys_property_names.include?(property)
intersys_property_names.include?(property.to_s)
end

def intersys_has_method?(method)
intersys_method_names.include?(method)
intersys_method_names.include?(method.to_s)
end

# Get the specified property
Expand All @@ -90,7 +90,7 @@ def method_missing(method, *args)
if match_data = method_name.match(/(\w+)=/)
return intersys_set(match_data.captures.first, args.first)
end
return intersys_get(method_name) if intersys_has_property?(method_name) && args.empty?
return intersys_get(method_name) if intersys_has_property?(method) && args.empty?
begin
return intersys_call(method_name, *args)
rescue NoMethodError => e
Expand Down

0 comments on commit 10bd58f

Please sign in to comment.