Module: Razor::CLI::Views
- Defined in:
- lib/razor/cli/views.rb
Class Method Summary collapse
- .find_formatting(spec, format, remaining_navigation) ⇒ Object
- .transform(item, transform_name) ⇒ Object
- .views ⇒ Object
- .views=(v) ⇒ Object
Class Method Details
.find_formatting(spec, format, remaining_navigation) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/razor/cli/views.rb', line 15 def find_formatting(spec, format, ) ||= '' # Scope will narrow by traversing the spec. scope = views spec = spec ? spec.split('/').drop_while { |i| i != 'collections'} : [] spec = spec + .split(' ') while spec.any? val = spec.shift scope = (scope[val] or {}) end scope["+#{format}"] or {} end |
.transform(item, transform_name) ⇒ Object
11 12 13 |
# File 'lib/razor/cli/views.rb', line 11 def transform(item, transform_name) Razor::CLI::Transforms.send(transform_name || 'identity', item) end |
.views ⇒ Object
7 8 9 |
# File 'lib/razor/cli/views.rb', line 7 def views @views ||= YAML::load_file(File::join(File::dirname(__FILE__), "views.yaml")) end |
.views=(v) ⇒ Object
4 5 6 |
# File 'lib/razor/cli/views.rb', line 4 def views= v @views = v end |