Module: ScaffoldSinatra::Utils
- Includes:
- Scaffolds
- Defined in:
- lib/scaffold_sinatra/utils.rb
Constant Summary
Constants included
from Scaffolds
Scaffolds::BASIC, Scaffolds::FILE_SCAFFOLD, Scaffolds::FULL, Scaffolds::STANDARD
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Scaffolds
#scaffold_with_value, #scaffolds, #value_of
Class Method Details
.add_scaffold_methods ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/scaffold_sinatra/utils.rb', line 7
def self.add_scaffold_methods
module_function(:scaffolds)
scaffolds.each_key do |level_of|
level = const_get(level_of.upcase)
define_method(:"#{level_of}_scaffold?") { @value >= level }
end
end
|
Instance Method Details
#include_in_scaffold?(file_name) ⇒ Boolean
#is_scaffold?(scaffold) ⇒ Boolean
25
26
27
|
# File 'lib/scaffold_sinatra/utils.rb', line 25
def is_scaffold?(scaffold)
!ScaffoldSinatra::Scaffolds.const_get(scaffold.upcase).nil?
end
|
#scaffold ⇒ Object
21
22
23
|
# File 'lib/scaffold_sinatra/utils.rb', line 21
def scaffold
scaffold_with_value(@value)
end
|
#scaffold=(scaffold) ⇒ Object
17
18
19
|
# File 'lib/scaffold_sinatra/utils.rb', line 17
def scaffold=(scaffold)
@value = value_of(scaffold)
end
|