Module: Picky::Generators::Partial
- Extended by:
- Helpers::Identification
- Defined in:
- lib/picky/generators/partial.rb,
lib/picky/generators/partial/none.rb,
lib/picky/generators/partial/infix.rb,
lib/picky/generators/partial/default.rb,
lib/picky/generators/partial/postfix.rb,
lib/picky/generators/partial/strategy.rb,
lib/picky/generators/partial/substring.rb
Defined Under Namespace
Classes: Infix, None, Postfix, Strategy, Substring, SubstringGenerator
Constant Summary collapse
Class Method Summary collapse
Methods included from Helpers::Identification
Class Method Details
.from(thing, index_name = nil, category_name = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/picky/generators/partial.rb', line 8 def self.from thing, index_name = nil, category_name = nil return Default unless thing if thing.respond_to? :each_partial thing else raise <<-ERROR partial options #{identifier_for(index_name, category_name)}should be either * for example a Partial::Substring.new(from: m, to: n), Partial::Postfix.new(from: n), Partial::Infix.new(min: m, max: n) etc. or * an object that responds to #each_partial(str_or_sym) and yields each partial ERROR end end |