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 = <<EOF
    attr_accessor :#{attribute}
    def self.#{attribute}(value=false, &action)
      value ? @#{attribute} = value : @#{attribute}_block = action
    end
    def self.#{attribute}_value_for(inst)
      return @#{attribute} if @#{attribute}
      @#{attribute}_block.call(inst)
    end
    def #{attribute}
      return @#{attribute} if @#{attribute}
      @#{attribute} = self.class.#{attribute}_value_for(self)
    end
EOF
    class_eval(script)
  end
end