Class: RubyPoint::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypoint/element.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#objectsObject

Returns the value of attribute objects.



4
5
6
# File 'lib/rubypoint/element.rb', line 4

def objects
  @objects
end

#parentObject

Returns the value of attribute parent.



4
5
6
# File 'lib/rubypoint/element.rb', line 4

def parent
  @parent
end

#presentationObject

Returns the value of attribute presentation.



4
5
6
# File 'lib/rubypoint/element.rb', line 4

def presentation
  @presentation
end

Class Method Details

.class_attributes(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubypoint/element.rb', line 7

def class_attributes(*args)
  args.each do |attribute|
    script = "    attr_accessor :\#{attribute}\n    def self.\#{attribute}(value=false, &action)\n      value ? @\#{attribute} = value : @\#{attribute}_block = action\n    end\n    def self.\#{attribute}_value_for(inst)\n      return @\#{attribute} if @\#{attribute}\n      @\#{attribute}_block.call(inst)\n    end\n    def \#{attribute}\n      return @\#{attribute} if @\#{attribute}\n      @\#{attribute} = self.class.\#{attribute}_value_for(self)\n    end\n"
    class_eval(script)
  end
end