Skip to content

Commit

Permalink
Merge branch 'release/v0.9.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Dec 11, 2013
2 parents 0ede6a1 + fd1c205 commit 672b443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions app/helpers/washout_builder_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get_fault_class_ancestors(fault, defined)
end

def get_virtus_model_structure(fault)
fault.attribute_set.inject({}) {|h, elem| h["#{elem.name}"]= { :primitive => "#{elem.primitive.to_s.downcase}", :options => elem.options }; h }
fault.attribute_set.inject({}) {|h, elem| h["#{elem.name}"]= { :primitive => "#{elem.primitive}", :options => elem.options }; h }
end


Expand All @@ -146,12 +146,12 @@ def get_fault_types(map)
complex_types = []
fault_types.each do |hash|
hash[:structure].each do |attribute, attr_details|
if attr_details[:primitive] == "array" && !WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:options][:member_type].primitive.to_s.downcase)
if attr_details[:primitive].to_s.downcase == "array" && !WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:options][:member_type].primitive.to_s.downcase)
complex_class = attr_details[:options][:member_type].primitive
elsif !WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive])
elsif attr_details[:primitive].to_s.downcase != "array" && !WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase)
complex_class = attr_details[:primitive]
end

param_class = complex_class.is_a?(Class) ? complex_class : complex_class.constantize rescue nil
if !param_class.nil? && param_class.ancestors.include?(Virtus::Model::Core)
get_fault_class_ancestors(param_class, complex_types)
Expand All @@ -161,6 +161,7 @@ def get_fault_types(map)

end
end
complex_types = complex_types.sort_by { |hash| hash[:fault].to_s.downcase }.uniq unless complex_types.blank?
[fault_types, complex_types]
end

Expand Down Expand Up @@ -230,11 +231,11 @@ def create_html_virtus_model_type(xml, param, fault_structure, ancestors)

fault_structure.each do |attribute, attr_details|
xml.li { |pre|
if WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive]) || attr_details[:primitive] == "nilclass"
pre << "<span class='blue'>#{attr_details[:primitive] == "nilclass" ? "string" : attr_details[:primitive] }</span>&nbsp;<span class='bold'>#{attribute}</span>"
if WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase) || attr_details[:primitive] == "nilclass"
pre << "<span class='blue'>#{attr_details[:primitive].to_s.downcase == "nilclass" ? "string" : attr_details[:primitive].to_s.downcase }</span>&nbsp;<span class='bold'>#{attribute}</span>"

else
if attr_details[:primitive] == "array"
if attr_details[:primitive].to_s.downcase == "array"
attr_primitive = attr_details[:options][:member_type].primitive.to_s

attr_primitive = WashoutBuilder::Type::BASIC_TYPES.include?(attr_primitive.downcase) ? attr_primitive.downcase : attr_primitive
Expand Down
2 changes: 1 addition & 1 deletion lib/washout_builder/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WashoutBuilder
VERSION = "0.9.3"
VERSION = "0.9.4"
end

0 comments on commit 672b443

Please sign in to comment.