Module: FAP::Mixins::Properties::ClassMethods

Defined in:
lib/fap/mixins/properties.rb

Instance Method Summary collapse

Instance Method Details

#date(name, *args) ⇒ Object Also known as: time



52
53
54
# File 'lib/fap/mixins/properties.rb', line 52

def date name, *args
  property name, 'DateTime', *args
end

#number(name, *args) ⇒ Object Also known as: integer



47
48
49
# File 'lib/fap/mixins/properties.rb', line 47

def number name, *args
  property name, 'Fixnum', *args
end

#property(name, *args) ⇒ Object

Define a new property.

property :foo, "String", :some => "options"
property :foo
property :foo, :some => "options"

Parameters:

  • property (Symbol)

    name

  • splat (Array)

    args



34
35
36
37
38
39
40
41
# File 'lib/fap/mixins/properties.rb', line 34

def property name, *args
  opts = {}
  opts.merge!(:type => args.shift) if args[0].class == String
  opts.merge!(*args) unless args.empty?
  property = FAP::Property.new name, opts
  self.properties << property
  define_property_getter property
end

#string(name, *args) ⇒ Object



43
44
45
# File 'lib/fap/mixins/properties.rb', line 43

def string name, *args
  property name, *args
end

#uri(name, *args) ⇒ Object



57
58
59
# File 'lib/fap/mixins/properties.rb', line 57

def uri name, *args
  property name, 'URI', *args
end