Class: Hippo::Extensions::Definition

Inherits:
Object
  • Object
show all
Includes:
Concerns::AttrAccessorWithDefault
Defined in:
lib/hippo/extension/definition.rb

Direct Known Subclasses

Base

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefinition

Returns a new instance of Definition.



30
31
32
# File 'lib/hippo/extension/definition.rb', line 30

def initialize
    self.add_to_load_path
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



11
12
13
# File 'lib/hippo/extension/definition.rb', line 11

def context
  @context
end

Class Method Details

.inherited(klass) ⇒ Object



7
8
9
# File 'lib/hippo/extension/definition.rb', line 7

def self.inherited(klass)
    Extensions.add(klass)
end

Instance Method Details

#add_to_load_pathObject



56
57
58
59
60
61
# File 'lib/hippo/extension/definition.rb', line 56

def add_to_load_path
    @in_load_path_set ||= (
        lib = root_path.join('lib').to_s
        $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
    )
end

#apply_configurationObject



63
64
65
66
67
68
# File 'lib/hippo/extension/definition.rb', line 63

def apply_configuration
     config_file = root_path.join('config', 'hippo.rb')
     if config_file.exist?
         require config_file
     end
end

#client_bootstrap_dataObject



42
43
44
# File 'lib/hippo/extension/definition.rb', line 42

def client_bootstrap_data
    {}
end

#client_extension_pathObject



70
71
72
# File 'lib/hippo/extension/definition.rb', line 70

def client_extension_path
    "#{identifier}/extension"
end

#load_after(extension) ⇒ Object



34
35
36
# File 'lib/hippo/extension/definition.rb', line 34

def load_after(extension)
    self.after = extension
end

#load_before(extension) ⇒ Object



38
39
40
# File 'lib/hippo/extension/definition.rb', line 38

def load_before(extension)
    self.before = extension
end

#on_dev_consoleObject



46
47
# File 'lib/hippo/extension/definition.rb', line 46

def on_dev_console
end

#route(route_set) ⇒ Object



49
50
51
52
53
54
# File 'lib/hippo/extension/definition.rb', line 49

def route(route_set)
    routes_config = root_path.join('config','routes.rb')
    if routes_config.exist?
        require routes_config
    end
end