lib/lookbook/entities/entity.rb in lookbook-1.5.5 vs lib/lookbook/entities/entity.rb in lookbook-2.0.0.beta.0
- old
+ new
@@ -1,9 +1,12 @@
module Lookbook
+ # Base entity class
+ #
+ # @api private
class Entity
include Comparable
- include Lookbook::Engine.routes.url_helpers
+ send(:include, Lookbook::Engine.routes.url_helpers) # YARD parsing workaround: https://github.com/lsegal/yard/issues/546
def initialize(lookup_path = nil)
@lookup_path = lookup_path
end
@@ -32,18 +35,20 @@
def url_path
nil
end
def type
- @_type ||= self.class.name.demodulize.underscore.downcase.to_sym
+ @_type ||= self.class.name.gsub("Entity", "").demodulize.underscore.downcase.to_sym
end
def <=>(other)
label <=> other.label
end
alias_method :path, :lookup_path
alias_method :logical_path, :lookup_path
+
+ deprecate path: :lookup_path, deprecator: Deprecation
protected
def fetch_config(key, fallback = nil, &block)
Utils.value_or_fallback(nil, fallback, &block)