diff options
Diffstat (limited to 'lib/active_relation/relations/rename.rb')
-rw-r--r-- | lib/active_relation/relations/rename.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/active_relation/relations/rename.rb b/lib/active_relation/relations/rename.rb deleted file mode 100644 index 9ab07707a0..0000000000 --- a/lib/active_relation/relations/rename.rb +++ /dev/null @@ -1,26 +0,0 @@ -module ActiveRelation - class Rename < Compound - attr_reader :attribute, :pseudonym - - def initialize(relation, pseudonyms) - @attribute, @pseudonym = pseudonyms.shift - @relation = pseudonyms.empty?? relation : Rename.new(relation, pseudonyms) - end - - def ==(other) - self.class == other.class and - relation == other.relation and - attribute == other.attribute and - pseudonym == other.pseudonym - end - - def attributes - relation.attributes.collect(&method(:christen)) - end - - private - def christen(attribute) - (attribute =~ self.attribute ? attribute.as(pseudonym) : attribute).bind(self) rescue nil - end - end -end
\ No newline at end of file |