lib/danger/plugin_support/plugin_parser.rb in danger-0.9.0 vs lib/danger/plugin_support/plugin_parser.rb in danger-0.9.1
- old
+ new
@@ -66,13 +66,18 @@
classes.select { |klass| klass.inheritance_tree.map(&:name).include? :Plugin }
end
def to_json
plugins = plugins_from_classes(classes_in_file)
- to_dict(plugins).to_json
+ to_h(plugins)
end
+ def to_json_string
+ plugins = plugins_from_classes(classes_in_file)
+ to_h(plugins).to_json
+ end
+
# rubocop:disable Metrics/AbcSize
def method_return_string(meth)
return "" unless meth[:tags]
@@ -138,10 +143,10 @@
read: method_parser(attribute[:read]),
write: method_parser(attribute[:write])
}
end
- def to_dict(classes)
+ def to_h(classes)
classes.map do |klass|
# Adds the class being parsed into the ruby runtime, so that we can access it's instance_name
require klass.file
real_klass = Danger.const_get klass.name
attribute_meths = klass.attributes[:instance].values.map(&:values).flatten