Class: Pageflow::PositionedFile
- Inherits:
-
Object
- Object
- Pageflow::PositionedFile
- Defined in:
- app/models/pageflow/positioned_file.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Null
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#position_x ⇒ Object
readonly
Returns the value of attribute position_x.
-
#position_y ⇒ Object
readonly
Returns the value of attribute position_y.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(file, position_x = nil, position_y = nil) ⇒ PositionedFile
constructor
A new instance of PositionedFile.
- #to_model ⇒ Object
Constructor Details
#initialize(file, position_x = nil, position_y = nil) ⇒ PositionedFile
Returns a new instance of PositionedFile.
7 8 9 10 11 |
# File 'app/models/pageflow/positioned_file.rb', line 7 def initialize(file, position_x = nil, position_y = nil) @file = file @position_x = position_x.presence || 50 @position_y = position_y.presence || 50 end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'app/models/pageflow/positioned_file.rb', line 3 def file @file end |
#position_x ⇒ Object (readonly)
Returns the value of attribute position_x.
3 4 5 |
# File 'app/models/pageflow/positioned_file.rb', line 3 def position_x @position_x end |
#position_y ⇒ Object (readonly)
Returns the value of attribute position_y.
3 4 5 |
# File 'app/models/pageflow/positioned_file.rb', line 3 def position_y @position_y end |
Class Method Details
.null ⇒ Object
28 29 30 |
# File 'app/models/pageflow/positioned_file.rb', line 28 def self.null Null.new end |
.wrap(file, position_x, position_y) ⇒ Object
24 25 26 |
# File 'app/models/pageflow/positioned_file.rb', line 24 def self.wrap(file, position_x, position_y) file ? new(file, position_x, position_y) : nil end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 16 17 18 |
# File 'app/models/pageflow/positioned_file.rb', line 13 def ==(other) super(other) || other == file || (other.is_a?(PositionedFile) && other.file == file) || (other.class == file.class && other.id == file.id) end |
#to_model ⇒ Object
20 21 22 |
# File 'app/models/pageflow/positioned_file.rb', line 20 def to_model file end |