lib/ronin/script/script.rb in ronin-1.3.0 vs lib/ronin/script/script.rb in ronin-1.4.0.rc1

- old
+ new

@@ -81,20 +81,37 @@ # The class-name of the cached object property :type, DataMapper::Property::Discriminator # The cached file of the object belongs_to :script_path, Ronin::Script::Path, :required => false + + # Validations + validates_uniqueness_of :version, :scope => [:name] end Path.has 1, base.relationship_name, base, :child_key => [:script_path_id] end # # @since 1.1.0 # module ClassMethods # + # The shortened name of the Script class. + # + # @return [String] + # The shortened name. + # + # @since 1.4.0 + # + # @api semipublic + # + def short_name + @short_name ||= self.name.split('::').last + end + + # # Loads the {Script} of the same class. # # @param [String] path # The path to load the script from. # @@ -173,23 +190,9 @@ if arguments.first.kind_of?(Hash) initialize_params(arguments.first) end super(*arguments,&block) - end - - # - # The script type. - # - # @return [String] - # The name of the script class. - # - # @since 1.1.0 - # - # @api semipublic - # - def script_type - @script_type ||= self.class.base_model.name.split('::').last end # # Determines if the original code, from the cache file, has been # loaded into the object.