renee-core 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,63 +0,0 @@
1
- class Renee
2
- class Core
3
- ##
4
- # Stores configuration settings for a particular Renee application.
5
- # Powers the Renee setup block which is instance eval'ed into this object.
6
- #
7
- # @example
8
- # Renee::Core.new { ... }.setup { views_path "./views" }
9
- #
10
- class Settings
11
- attr_reader :includes, :variable_types
12
- def initialize
13
- @includes = []
14
- @variable_types = {}
15
- @encoding = 'utf-8'
16
- register_variable_type :integer, IntegerMatcher
17
- register_variable_type :int, :integer
18
- end
19
-
20
- # Gets or sets the views_path for an application.
21
- #
22
- # @param [String] path The path to the view files.
23
- #
24
- # @example
25
- # views_path("./views") => nil
26
- # views_path => "./views"
27
- #
28
- # @api public
29
- def views_path(path = nil)
30
- path ? @views_path = path : @views_path
31
- end
32
-
33
- # Gets or sets the default encoding used.
34
- #
35
- # @param [String] encoding The encoding to use. e.g. "utf-8"
36
- def default_encoding(encoding = nil)
37
- encoding ? @encoding = encoding : @encoding
38
- end
39
-
40
- # Module(s) to include into the base application.
41
- #
42
- # @param [Module] mods Modules to include.
43
- def include(*mods)
44
- mods.each { |mod| includes << mod }
45
- end
46
-
47
- # Registers a new variable type for use within {Renee::Application::Routing#variable} and others.
48
- # @param [Symbol] name The name of the variable.
49
- # @param [Regexp] matcher A regexp describing what part of an arbitrary string to capture.
50
- # @return [Renee::Core::Matcher] A matcher
51
- def register_variable_type(name, matcher)
52
- matcher = case matcher
53
- when Matcher then matcher
54
- when Array then Matcher.new(matcher.map{|m| @variable_types[m]})
55
- when Symbol then @variable_types[matcher]
56
- else Matcher.new(matcher)
57
- end
58
- matcher.name = name
59
- @variable_types[name] = matcher
60
- end
61
- end
62
- end
63
- end
@@ -1,6 +0,0 @@
1
- class Renee
2
- class Core
3
- # Current Renee-core version number.
4
- VERSION = "0.2.0"
5
- end
6
- end