Module: Magnetic
- Defined in:
- lib/magnetic/field.rb,
lib/magnetic/interface.rb
Defined Under Namespace
Modules: Field
Classes: Interface, Path
Class Method Summary
collapse
Class Method Details
.field(*argv, &block) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
# File 'lib/magnetic/field.rb', line 213
def self.field *argv, &block
name = argv.delete_first{|arg| String === arg or Symbol === arg }
base = argv.delete_first{|arg| Field::Base.class === arg}
configure = argv.delete_first{|arg| ['configure', :configure].include? arg}
options = argv.delete_first{|arg| Hash === arg}
options ||= {}
options.to_options!
base ||= Field::Base
field = base.clone
field.name = name
field.owner = self
field.configure options, &block
field
end
|
.path(*a, &b) ⇒ Object
3
|
# File 'lib/magnetic/interface.rb', line 3
def self.path(*a, &b) a.size == 0 ? Path : Path.new(*a, &b) end
|